View Full Version : Create Report based on combo box selection


jlocke
04-28-2005, 12:09 PM
Ok here is my problem, i have a report selection form which help generate report based on all types of criteria, the one problem i have is when i i don't fill in the Agent box(see snapshot)(left empty) i want all agents on my report. here is the sql code i have. I have tried various Iif statement combos

((tblData.[Beazley Agent])=IIf([Forms]![frmReportDateRange]![cboAgent] Is Not Null,[Forms]![frmReportDateRange]![cboAgent])));

RichO
04-30-2005, 11:35 PM
If you are opening your report from a form how about something like this:

DoCmd.OpenReport "MyReport", acPreview, , IIf(Nz(Me.cboAgent) = "", "", "[Beazley Agent] = '" & Me.cboAgent & "' ")

jlocke
05-02-2005, 07:19 AM
:) Richo thank you works perfect! I've tried somthing like your code but the Nz i beleive is what i needed.