I appreciate the help guys. Time to home for me as well.
I appreciate the help guys. Time to home for me as well.
I don't use dynamic parameterized queries. I use VBA to build string of filter criteria and apply to form or report when opening.
These work:
LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[1-8]", [Forms]![Switchboard]![Store])
LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[3,6,9]", [Forms]![Switchboard]![Store])
LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[1-8,9]", [Forms]![Switchboard]![Store])
But this does not pull in 21:
LIKE IIf([Forms]![Switchboard]![Store] = "ALL", "[1-8,21]", [Forms]![Switchboard]![Store])
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Hi -
You could try this. Take the parameter right out of the query - let the query return all records.
Then, in the procedure that calls the report, you can do something like this:
If ComboBox = "ALL" then
DoCmd.OpenReport "Report_Name", acViewPreview,,"Store_Number in ('01', '02', '03', '04', '05', '06', '07', '08', '21')"
else
DoCmd.OpenReport "Report_Name", acViewPreview,,"Store_Number = '" & combobox & "'"
endif
replacing the italics with the actual names you have in your database.
HTH
John
Exactly what I was suggesting.
Or one line with IIf
DoCmd.OpenReport "Report_Name", acViewPreview, , "Store_Number " & IIf(Me.Store="ALL", "IN (1,2,3,4,5,6,7,8,21)", "=" & Me.Store)
Is Store_Number a number or text type field?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.