Hello,
I am trying to create a button that will filter data in a subform to match what is written in a text box. I am using the following code:
"
Private Sub cmdSearchPrice_Click()
Dim SQL As String
SQL = "SELECT [Price].[ID], [Price].[CodeName], [Price].[PricingType], [Price].[PricingDate], [Price].[Price] " _
& "FROM Price " _
& "WHERE [CodeName] LIKE '*" & Me.txtCodeName & "*' " _
& "WHERE [PricingDate] LIKE '*" & Me.txtPriceDate & "*' " _
& "ORDER BY [Price].[CodeName] ; "
Me.subPrice.Form.RecordSource = SQL
End Sub
"
The code works when I do not have the second "WHERE... line. When I add that line to refine the search to include date, it gives the following error:
"
Run-time error '3075':
Syntax error (missing operator) in query expression '[CodeName] LIKE '**' WHERE [PricingDate] LIKE '**"
"
I am teaching myself VBA and am very new to this, so please and thanks for any help!
-Brian