Combo Boxes

Dave_cha

Registered User.
Local time
Today, 09:03
Joined
Nov 11, 2002
Messages
119
Hi all,

I have a combo box who's Row Source Type is set to Table/Query and who's Row Source pulls 2 columns of data from an existing table (UserID;UserName).

I would like to set the first row on the combo to "*;Select All" and follow this by "UserID;UserName" for all users in the table.

I've tried using combobox.additem Item: = "*;Select All",Index: = 0 but it requires the combo box to have the Row Source Type set to Value List though I'm not sure how to pull in the table data if the type is set to Value List.

Any Idea's how I can get around this problem?

Thanks,

Dave
 
You need to use a UNION query like this:

SELECT 0 AS CodeID," Select All" AS Description FROM Your_Table_Name UNION SELECT UserID, UserName FROM Your_Table_Name ORDER BY 2

..make that SQL line your rowsource or save it as a query.
 
Thanks Meltdown.....that's perfect.
Is there any way of filling the CodeID with a wildcard (*) rather than a 0?

Thanks,

Dave
 
I don't think so, the wildcard * is reserved in Access, and you'll also get a datatype mismatch because your UserID field is probably a AutoNumber or Number data type.

The UserID should be hidden from the user by setting the Column Width property to: 0cm;4cm;

You write code that doesn't apply a filter when the combo value = 0

ps: Hey, I just noticed you're from Wexford, I'm only up the road from you in Blackrock, Dublin. and I'm also called Dave...small world
 
Last edited:

Users who are viewing this thread

Back
Top Bottom