W
warrenjburns via AccessMonster.com
Hi,
I have a syntax error... the problem is when the Me.RecipeIngredient not
selected the builder still requires a value for the join and or strSQL... I
think?
When the Me.RecipeIngredient is selected the expression work very well and
builder and select values from form and subform and BuildFilter accordingly.
The error is:
Run-time error '3075':
Syntax error (missing operator) in query expression
'RecipeIngredients.RecipeIngredientID='.
The expression is:
Private Sub SearchButton_Click()
Dim strSQL As String, strWhere As String
If IsNull(Me.RecipeIngredient) Then
strSQL = "SELECT * FROM BeveragesSearch"
strWhere = BuildFilter(" WHERE ")
Else
strSQL = "SELECT BeveragesSearch.* FROM BeveragesSearch " & _
"INNER JOIN RecipeIngredients ON " & _
"BeveragesSearch.IngredientID = RecipeIngredients.IngredientID " & _
"WHERE RecipeIngredients.RecipeIngredientID = " & Me.RecipeIngredient
strWhere = BuildFilter(" AND ")
End If
strSQL = strSQL & strWhere
Me.Beverages.Form.RecordSource = strSQL
Me.Beverages.Requery
End Sub
Please help
Warren.
I have a syntax error... the problem is when the Me.RecipeIngredient not
selected the builder still requires a value for the join and or strSQL... I
think?
When the Me.RecipeIngredient is selected the expression work very well and
builder and select values from form and subform and BuildFilter accordingly.
The error is:
Run-time error '3075':
Syntax error (missing operator) in query expression
'RecipeIngredients.RecipeIngredientID='.
The expression is:
Private Sub SearchButton_Click()
Dim strSQL As String, strWhere As String
If IsNull(Me.RecipeIngredient) Then
strSQL = "SELECT * FROM BeveragesSearch"
strWhere = BuildFilter(" WHERE ")
Else
strSQL = "SELECT BeveragesSearch.* FROM BeveragesSearch " & _
"INNER JOIN RecipeIngredients ON " & _
"BeveragesSearch.IngredientID = RecipeIngredients.IngredientID " & _
"WHERE RecipeIngredients.RecipeIngredientID = " & Me.RecipeIngredient
strWhere = BuildFilter(" AND ")
End If
strSQL = strSQL & strWhere
Me.Beverages.Form.RecordSource = strSQL
Me.Beverages.Requery
End Sub
Please help
Warren.