I have a form for looking up records. There is a text field on the form to put in a number that can be found in the table (tbl_data) field named 8DNumber which is a number field.
A subform in datasheet view is on the form to show the results of the search with the linked fields being 8DNumber.
I keep getting a Run-Time Error 3075 (Syntax error in query expression
What am I doing wrong with this code?
A subform in datasheet view is on the form to show the results of the search with the linked fields being 8DNumber.
I keep getting a Run-Time Error 3075 (Syntax error in query expression
What am I doing wrong with this code?
Code:
Private Sub cmdRecordSearch_Click()
Dim strsearch As String
Dim Task As String
If IsNull(Me.txtSearch) Or Me.txtSearch = "" Then
MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
Me.txtSearch.SetFocus
Else
strsearch = Me.txtSearch.Value
Task = "SELECT * FROM tbl_data WHERE ((8DNumber Like ""*" & strsearch & "*""))"
Me.RecordSource = Task
End If
End Sub