B
Bill Case
Hi Gary:
Thanks for the wonderful help so far. I've built the
form with four combo boxes, and when I search on one box
alone, it works brilliantly, however, when I search on
more than one box, it returns the following error:
Run-time error '3075':
Syntax error (missing operator) in query expression '(
AND RepCompany = 'CEW Lighting')'.
Here's the code I have in place:
Private Sub Command13_Click()
Dim strSQL As String
strSQL = ""
If IsNull(Me!EManfCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "Manufacturer = '" & Me.EManfCombo & "'"
Else
strSQL = "Manufacturer = '" & Me.EManfCombo & "'"
End If
End If
If IsNull(Me!EProdCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "Product = '" & Me.EProdCombo & "'"
Else
strSQL = " AND Product = '" & Me.EProdCombo & "'"
End If
End If
If IsNull(Me!ERepNameCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "RepName = '" & Me.ERepNameCombo & "'"
Else
strSQL = " AND RepName = '" & Me.ERepNameCombo
& "'"
End If
End If
If IsNull(Me!ERepCoCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "RepCompany = '" & Me.ERepCoCombo & "'"
Else
strSQL = " AND RepCompany = '" & Me.ERepCoCombo
& "'"
End If
End If
DoCmd.OpenReport "Electrical Catalogs", acViewPreview, ,
strSQL
DoCmd.Maximize
End Sub
.. . . . . .
Anything more you can offer will be greatly appreciated.
Again, thanks for getting me this far.
Thanks for the wonderful help so far. I've built the
form with four combo boxes, and when I search on one box
alone, it works brilliantly, however, when I search on
more than one box, it returns the following error:
Run-time error '3075':
Syntax error (missing operator) in query expression '(
AND RepCompany = 'CEW Lighting')'.
Here's the code I have in place:
Private Sub Command13_Click()
Dim strSQL As String
strSQL = ""
If IsNull(Me!EManfCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "Manufacturer = '" & Me.EManfCombo & "'"
Else
strSQL = "Manufacturer = '" & Me.EManfCombo & "'"
End If
End If
If IsNull(Me!EProdCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "Product = '" & Me.EProdCombo & "'"
Else
strSQL = " AND Product = '" & Me.EProdCombo & "'"
End If
End If
If IsNull(Me!ERepNameCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "RepName = '" & Me.ERepNameCombo & "'"
Else
strSQL = " AND RepName = '" & Me.ERepNameCombo
& "'"
End If
End If
If IsNull(Me!ERepCoCombo) = False Then
If Len(strSQL) = 0 Then
strSQL = "RepCompany = '" & Me.ERepCoCombo & "'"
Else
strSQL = " AND RepCompany = '" & Me.ERepCoCombo
& "'"
End If
End If
DoCmd.OpenReport "Electrical Catalogs", acViewPreview, ,
strSQL
DoCmd.Maximize
End Sub
.. . . . . .
Anything more you can offer will be greatly appreciated.
Again, thanks for getting me this far.