I have a form Named Teacher_Fine which contains the following fields:
Teacher ID
TeachFine_ID
Date
Absent Late
When I put Teacher ID in the search box and click search it shows this error:
"Run-time error 3075 Syntax error (missing operator) in query expression '((Teacher ID Like "*2*"))'
I use the following VBA Code which I get from youtube:
Private Sub Command15_Click()
Dim strsearch As String
Dim Task As String
'Check if a keyword entered or not
If IsNull(Me.TxtSearch) Or Me.TxtSearch = "" Then
MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
Me.TxtSearch.BackColor = vbYellow
Me.TxtSearch.SetFocus
Else
strsearch = Me.TxtSearch.Value
Task = "SELECT * FROM Teacher_Fine WHERE ((Teacher ID Like ""*" & strsearch & "*""))"
Me.RecordSource = Task
Me.TxtSearch.BackColor = vbWhite
End If
End Sub
Kindly help me anyone in this regard that, where I missing something?
Regards
Teacher ID
TeachFine_ID
Date
Absent Late
When I put Teacher ID in the search box and click search it shows this error:
"Run-time error 3075 Syntax error (missing operator) in query expression '((Teacher ID Like "*2*"))'
I use the following VBA Code which I get from youtube:
Private Sub Command15_Click()
Dim strsearch As String
Dim Task As String
'Check if a keyword entered or not
If IsNull(Me.TxtSearch) Or Me.TxtSearch = "" Then
MsgBox "Please type in your search keyword.", vbOKOnly, "Keyword Needed"
Me.TxtSearch.BackColor = vbYellow
Me.TxtSearch.SetFocus
Else
strsearch = Me.TxtSearch.Value
Task = "SELECT * FROM Teacher_Fine WHERE ((Teacher ID Like ""*" & strsearch & "*""))"
Me.RecordSource = Task
Me.TxtSearch.BackColor = vbWhite
End If
End Sub
Kindly help me anyone in this regard that, where I missing something?
Regards