Link to home
Start Free TrialLog in
Avatar of sbishop
sbishop

asked on

Adding options to a combobox - Access95

My problem is this.  I have a dropdown combobox with a list of options that have been pulled from a table.  This will be an argument for a query.  The problem is I want to add the option of "ALL" into the combobox(as in wanting to query all of the values in the combobox), but I don't want to hard code the table's values into it the combobox(it must go to the database to get the most up-to-date values, as they can change.)

Also, is there anyway that you can start an Access DB with the Access95 program minimised so it can't be seen(just the forms visible)
Avatar of chanlaw
chanlaw

sbishop,

Your can find your solution on the Access help file. Type AddAllToList function in the Index Tab-page under help.
Your can also find an example on the sample database "Developer solutions" database which comes with MS Access 97. (It should also be included in access 95.) Open the DeveloperSolutions Form. Select "Work with combo boxes, list boxes, ...", and then choose All "(all)" to a list.

Cheers,
Kinfai.
Avatar of sbishop

ASKER

Kinfai,
That doesn't work Kinfai.  Help returns nothing similar to AddAllToList.  I am only running Access95 and it's on a Uni computer, so they don't have any example databases to look at.
Where would this function be written?  In the combobox code for what, OnClick? Thanks.

sbishop
ASKER CERTIFIED SOLUTION
Avatar of chanlaw
chanlaw

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK, sbishop,

Here is a much simpler way to solve your problem :

For example, you have a table Customers. In RowSource property of control you write:

SELECT id,name FROM Customers UNION SELECT 0 AS id,'(All)' AS
name FROM Customers ORDER BY name

Thats all! no terrific functions, no errors, no headache.

The solution was suggested by a clever guy called Dmitry Aupuchtin.
Nice one !
0 should be changed to '*' thought.
Avatar of sbishop

ASKER

Thanks Chanlaw, I used your method.  Much eaiser!

No need to thank me. If you do appreciate, send compliments to Dmitry Apuchtin:  damian@ems.ru