Hello Everyone,
I am currently making a form that using combo boxes to filter a query for a report. I am using doCmd to open the report using two where conditions. The where conditions get their values from the combo box drop down list. As you can see below, I am attempting to open the report "FORM x" with multiple argument where conditions joining them with AND. However when I run this command I get a type mismatch error. I have tried isolating the issue by only using one where condition at a time and have found that filtering by date only or by vendorID only works perfectly fine. But when I try to combine the two where statements into one so I can filter by both parameters at once I receive a type mismatch error.
Works
Code:
DoCmd.OpenReport "FORM x", acViewPreview, , " [Date] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"
Works
Code:
DoCmd.OpenReport "FORM x", acViewPreview, , "[VendorID]='" & Me.cboVendorID & "'"
Doesn't Work
Code:
DoCmd.OpenReport "FORM x", acViewPreview, , "[VendorID]='" & Me.cboVendorID & "'" And " [Date] Between #" & Me.cboFrom & "# And #" & Me.cboTo & "#"
Any help at all would be extremely appreciative.
Thank you
Josh