Multiple Combo Box for Report

  • Thread starter Thread starter SAQ
  • Start date Start date
S

SAQ

I am working with multiple combo boxed to report based on selected criteria.
Some of the combo boxes may not have been selected. If I was using this as
the source for the report and saying = combo1 & combo2 & combo3 the
resulting output would not work as combo2 may be blank making the result
invalid. Is there a straightforward way of achieving this.
 
The method I use is like:

Dim strWhere as String
strWhere = " 1=1 "
If Not IsNull(Me.ComboEyes) Then
strWhere = strWhere & "AND [EyeColourID] =" & Me.ComboEyes
End If
If Not IsNull(Me.ComboHair) Then
strWhere = strWhere & "AND [HairColourID] =" & Me.ComboHair
End If
'etc
DoCmd.OpenReport "rptYourReport", , , strWhere
 
Back
Top