View Full Version : IIF (I want it to cancel or do nothing)


sps2
10-11-2008, 10:08 AM
Hello all, first time on the fourm.

IIf(IsNull([forms]![DateSelectionWO]![OrganizationCombo]),"",[forms]![DateSelectionWO]![OrganizationCombo])

This is checking a form to see if a selection was made in a combo box "OrganizationCombo". If so then the report show the records matching the selection. What I would like, is if no selection were made, the report would show all records. With a selection made it works fine, when no selection is made the report shows no records.

Thanks for any help.

http://www.access-programmers.co.uk/forums/C:\Documents and Settings\rwwilso\Desktop\iif.bmp

Uncle Gizmo
10-11-2008, 11:12 AM
For clarity my understanding is that you have a combo box which filters the records that can be shown in a report.

I would guess this is achieved by filtering a query on the combo box selection, and then basing the report on that query.

The report could be called by the after update event of the combo box or possibly by a separate command button.

If the above the assumptions are correct, then one possible solution is to generate two text SQL statements in your form, one SQL statement which uses the combo box selection, and another SQL statement that returns all of the results. Depending on whether a selection is made in the combo box use one or another of the SQL statements, pass these SQL strings through to the reports record source property via OpenArgs.

Kiwiman
10-11-2008, 11:19 AM
Howzit

Another way is to include "ALL" in your combobox and make the "*" as the default selection.

As the all option is default, it will run the report for all the data, unless the user specifically changes to a specific subset.

Check out the link below, re putting "ALL" in your combobox

http://www.mvps.org/access/forms/frm0043.htm

sps2
10-11-2008, 11:35 AM
Thank you both for responding. I will work on these and let you know. Thanks again.