Hi. I tried to post this in a different forum but it didn't look like my post went through and this looks more like the appropriate forum. I am trying to create a search box that allows me to filter data for multiple rows with whatever data was entered. I used this video as reference. https://www.youtube.com/watch?v=N0X8Hg-Sm6A&t=46s
I was successfully able to do this for items so I tried to expand it. Here is my code.
Code:
Option Compare Database
Option Explicit
Private Sub BtnSearch_Click()
Dim SQL As String
SQL = "SELECT Assets.ID, Assets.Truck, Assets.Yard, Assets.Time, Assets.Program, Assets.VehicleCondition, Assets.Defects" _
& "FROM Assets " _
& "Where [Truck] LIKE '*" & Me.TxtKeywords & "*' " _
& "OR [Yard] LIKE '*" & Me.TxtKeywords & "*' " _
& "OR [Program] LIKE '*" & Me.TxtKeywords & "*' " _
& "OR [VehicleCondition] LIKE '*" & Me.TxtKeywords & "*' " _
Me.SubCustomerList.Form.RecordSource = SQL
Me.SubCustomerList.Form.Requery
End Sub
The error I get ts "Run-time error '3075':
Syntax error (missing operator) in query expression 'Assets.DefectsFROM Assets Where [Truck] Like '*B91* OR [Yard] LIKE '*B91*' OR [Program] LIKE '*B91' OR [VehicleCondition] LIKE '*B91*. When I click debug, it highlights the bolded line of code (Me.SubCustomerList.Form.RecordSource = SQL)
Thanks for your help!