The code I used is:
Private Sub cmdSearch_Click()
'On Error Resume Next
Dim sql As String
If txtSearch.Text = "" Then
MsgBox "Type in the search field to proceed"
Exit Sub
End If
sql = "SELECT * FROM booksReg WHERE book_title =" & Trim(txtSearch.Text) & ""
connect
rec.Open "booksReg", con, adOpenKeyset, adLockOptimistic
If myrec.RecordCount = 1 Then
With myrec
lblBalance = .Fields("quantity")
lblAuthor = .Fields("author")
lblISBN = .Fields("quantity")
End With
Else
MsgBox "No record details exist for the supplied data"
End If
Set mycon = Nothing
myrec.Close
txtSearch.Text = ""
optTitle.Value = False
txtSearch.SetFocus
End Sub
This post has been edited by no2pencil: 26 January 2011 - 01:47 AM
Reason for edit:: Corrected code tags

New Topic/Question
Reply




MultiQuote





|