>I am attempting to open a report with more than one where condition
>and I am getting a Type Mismatch error. I can't figure out quite how
[quoted text clipped - 19 lines]
>First of all, can I filter a report through a form with more than one
>where condition?
This kind of thing is usually handled with this kind of
logic:
If Len(cboFilter1 & "") <> 0 Then
stWhere = stWhere & " And somefield = " & cboFilter1
End If
If Len(cboSearchReportsTo & "") <> 0 Then
stWhere = stWhere & "And tofield = " & cboSearchReportsTo
End If
If Len([cboZone] & "") <> 0 Then
stWhere = stWhere & " And ZoneID = " & cboZone
End If
If Len([cboSearchTM] & "") <> 0 Then
stWhere = stWhere & " And TMfield = " & cboSearchTM
End If
If Len([cboSearchDept] & "") <> 0 Then
stWhere = stWhere & " And DeptID = " & cboSearchDept
End If
DoCmd.OpenReport "rptByShop", acPreview, , Mid(stWhere, 6)
BUT that only works for number type fields. If a field is a
Text field, then use:
stWhere = stWhere & " And textfield = """ & cboxxx & """"
And for a date fields:
stWhere = stWhere & " And datefield = #" & cboyyy & "#"

Signature
Marsh
MVP [MS Access]
Opal - 30 Jul 2008 20:17 GMT
> >I am attempting to open a report with more than one where condition
> >and I am getting a Type Mismatch error. I can't figure out quite how
[quoted text clipped - 54 lines]
>
> - Show quoted text -
Thank you, Marsh, that helps alot! They are number fields.