Combo box

billmark

Board Regular
Joined
Dec 11, 2011
Messages
59
Hi
I created a combo box in the form to select the record and export to excel (I created a button). Please advise how to make the combo box with one blank at the top of the list so that I select the blank, then all record can be exported to excel.

Regards
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
I tried this in the Row Source 'Select clt.Field1 FROM Client UNION Select "(All)" FROM Client GROUP BY clt.Field1'. When I select ALL from the combo box, it gives me blank.
Please advise how to fix.
 
Upvote 0
I tend to use a union and 0 for All. Then test for 0. If 0, select everything, if not build the criteria then select
 
Upvote 0
I tried this
Select “ALL” FROM Client UNION Select clt.Field1 FROM Client GROUP BY clt.Field1

and a prompt to ask me to Enter the parameter.

Please assist if I need to adjust in the properties table or advise the correct statement.

The table Client has 5 fields.
 
Upvote 0
Firstly, whilst you can have as many fields as you want in a combo, I try and stick with 2. The PK Autonumber and the field I want as the dexcription.

Code:
SELECT ID, Rank from Rank
UNION
Select 0 AS ID, "All" as Rank from Rank
Order by ID

Then check for non zero ID and filter/adjust accordingly.

HTH
 
Upvote 0
cross posted
 
Upvote 0
I think based on the information on the other post, the issue you have is you want the combo box to say ALL but have the query checking for Null. change it to check for 'ALL':

VBA Code:
[forms]![main]![cbofield1] or [forms]![main]![cbofield1] = "ALL"

basically the second part of the expression evaluates to true if the combo box has ALL in it therefore returning all records.
 
Upvote 0

Forum statistics

Threads
1,223,948
Messages
6,175,571
Members
452,652
Latest member
eduedu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top