View Full Version : Default Value in Combo Box


wrek
08-14-2001, 10:36 AM
Hi all,

I have a table Preparer List, with two columns - User (primary key) and Computer.

(eg. [John Smith, 3P15], [Jane Doe, 3Q14])

I've got a login form on which there is a combobox showing all the preparer names. LimitToList = No, because I want any user to access it.

I've also got a function that determines the computer name (automatically). How do I set the default value in the combo box to 'John Smith', if my function returns '3P15'?

(this would save the user a lot of hassle putting in the info for login purposes...I don't want to make it restrictive, they should be able to change it...for instance if their logging in from someone elses computer)

tx. Bye all.

Abby N
08-16-2001, 08:14 AM
If I'm understanding your question correctly then you can use a DLookup in the combobox's default value. Something like:

=DLookup("[User]", "[Preparer List]", "[Computer] = '" & CurrentComputer &"'")

where CurrentComputer is your function that returns the computer name. Good Luck.

~Abby

wrek
08-16-2001, 09:15 AM
Dear abby (yeah I know, I'm awful),

you read the question right. Dlookup is the correct way to do it, I stumbled on it yesterday actually....

...just responding to let you know that you were right.

Thanx anyway,

wrek.