Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select All items from a Combo Box

Status
Not open for further replies.

Tash

MIS
Nov 3, 2001
62
US
I would like to be able to Select All for a Combo box I created. I followed the SQL suggested on the Microsoft site, and the "(All)" option is showing up in the Combo Box as an option, however, my query for the report is not recognizing that it needs to display all the values. Could you help me with this?

This is the SQL that I am using:
SELECT DISTINCT Department FROM TableEmployeeProfile UNION SELECT "(All)" FROM TableEmployeeProfile

I tried to add a Null or Like"*" after the Union Select, but recieved an error that my columns were incorrect.

Thanks in advance for your help!
 
Simple, If the Value of Combo box is "(All)" there is no WHERE Condition Else put a WHERE condition.

Code:
If Combo1 = "(All)" Then
  DoCmd.OpenReport <<RepName>>, acViewPreview
Else
  DoCmd.OpenReport <<RepName>>, acViewPreview,,"<<FieldName>> = '" & Combo1 & "'"
Endif

Regards,
 
THANK YOU, it worked! Of course that makes total sense to me now. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top