Multiple filters

  • Thread starter Thread starter Billy Banter
  • Start date Start date
B

Billy Banter

Can anybody give me some guideance regarding multiple filters on a report.

I want something like this.

On Error GoTo Err_Command20_Click

Dim stDocName As String

stDocName = "AuditReport"
DoCmd.OpenReport stDocName, acPreview, , "ClaimType=
forms!form1!ClaimType" & "MethodNo= forms!form1!MethodNo"
Exit_Command20_Click:
Exit Sub

Err_Command20_Click:
MsgBox Err.Description
Resume Exit_Command20_Click

End Sub

Regards
Billy
 
Assuming ClaimType and MethodNo are both numeric.
Dim strWhere as String
strWhere = "ClaimType= " & forms!form1!ClaimType
strWhere = strWhere & " And MethodNo= " & forms!form1!MethodNo
DoCmd.OpenReport stDocName, acPreview, , strWhere
If either of the fields arestring then you will need to concatenate double
or single quotes around the control references.
 
Thanks for the reply, I worked out another way as well.

Dim stDocName As String

stDocName = "AuditReport"
DoCmd.OpenReport stDocName, acPreview, , WhereCondition:="MethodNo = " &
Me.MethodNo _
& " AND ClaimType = " & Me.ClaimType
 
Your method works fine also. I like to build the where condition in a
variable and then use the variable in the OpenReport method. It's a matter
of style.
 
Back
Top