Hi,
I have a form with a filter of 3 combo boxes, which the user select to specify the information they want to find.A report will then display all information matching the search criteria. i keep getting the error message of :
'Syntax error (missing operator)in query expression.'
Below is my code:
Please could anyone tell me what i've done wrong. Thanks
Michelle
I have a form with a filter of 3 combo boxes, which the user select to specify the information they want to find.A report will then display all information matching the search criteria. i keep getting the error message of :
'Syntax error (missing operator)in query expression.'
Below is my code:
Code:
Private Sub CmdApplyfilter_Click()
Dim StrCommercial As String
Dim StrCustomer As String
Dim StrStatus As String
Dim StrFilter As String
'Code to automatically open report
If SysCmd(acSysCmdGetObjectState, acReport, "rptRFQ Receipt to Tender Sent") <> acObjStateOpen Then
DoCmd.OpenReport "rptRFQ Receipt to Tender Sent", acViewPreview, StrFilter
End If
'Build Criteria string for Commercial Staff
If IsNull(Me.Cbocommercial.Value) Then
StrCommercial = "Like '*'"
Else
StrCommercial = "='" & Me.Cbocommercial.Value & "'"
End If
'Build Criteria string for Customer
If IsNull(Me.CboCustomer.Value) Then
StrCustomer = "Like '*'"
Else
StrCustomer = "='" & Me.CboCustomer.Value & "'"
End If
'Build Criteria string for Status
If IsNull(Me.CboStatus.Value) Then
StrStatus = "Like '*'"
Else
StrStatus = "='" & Me.CboStatus.Value & "'"
End If
'Combine criteria strings into WHERE clause for the filter
StrFilter = " [Commercial] " & StrCommercial & " AND [Customer]" & StrCustomer & " [Order Status] " & StrStatus
'Apply the filter and switch on
With Reports![rptRFQ Receipt to Tender Sent]
.Filter = StrFilter
.FilterOn = True
End With
End Sub
Please could anyone tell me what i've done wrong. Thanks
Michelle