Private Sub cmdfind_Click()
Dim search As String
search = txtfind.Text
Con.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\HOSTEL STUDENT.mdb;Persist Security Info=False"
Rs.Open "SELECT * FROM STUDENTS WHERE [REG] LIKE" & "'" & search & "'", Con, adOpenStatic, adLockOptimistic
Do Until Rs.EOF
Rs.MoveNext
Loop
If Rs.EOF = True Or Rs.BOF = True Then
MsgBox "PLEASE REGISTER YOUR NAME TO WARDEN"
Else
txtNAME = Rs.Fields("NAME")
txtMATRIX = Rs.Fields("MATRIX NO")
txtIC = Rs.Fields("IC NO")
txtCONT = Rs.Fields("CONTACT NO")
txtROOM = Rs.Fields("ROOM NO")
End If
Rs.Close
Con.Close
End Sub
sonunclejalil
0
Newbie Poster
Recommended Answers
Jump to Postwhat object and what error message?
Jump to Postthis is because you open a connection which is already opened.First you open the connection inside
OpenConnection()
procedure and then again you open the connection incmdfind_Click()
procedure.so remove line 7 from
cmdfind_Click()
procedure.you should also consider followings:-
when you done a database task then …
All 7 Replies
tinstaafl
1,176
Posting Maven
sonunclejalil
0
Newbie Poster
sonunclejalil
0
Newbie Poster
rishif2
57
Posting Whiz in Training
sonunclejalil
0
Newbie Poster
rishif2
57
Posting Whiz in Training
sonunclejalil
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.