Students helping students, join us in improving Bored of Studies by donating and supporting future students!
'Run the search.
Data1.RecordSource = "(" & SQLQuery & ")"
Data1.Refresh
Data1.moveFirst/moveNext/MovePrevious/MoveLast etc...
Data1.recordsource = ("SELECT * FROM table1")
Data1.refresh
Data1.RecordSource = "(SELECT * FROM table1)"
Private Sub cmdTitle_Click()
' search the database with the SQL string
' looking for the person with the name entered
' in the textbox
Set rs = db.OpenRecordset("SELECT * FROM table1 WHERE Title='" & txtSearch.Text & "'")
datbase.RecordSource = ("SELECT * FROM table1 WHERE Title='" & txtSearch.Text & "' & ")
datbase.Refresh
' this on error resume next will catch errors
' if there are no matches in the database
On Error Resume Next
' if there is nothing in the recordset, it means
' the search returned nothing. So let the user know
If Err.Number = 3021 Then
MsgBox "There are no matches."
End If
End Sub