How to set default value of a combo box via table

Arvin

I'm liv'in the dream ....
Local time
Today, 15:41
Joined
Jul 22, 2008
Messages
192
Hello,

i'm kinda new at access ....

I would like to a default value for a combo box that has a table bound to it. The default value will come from within the table that is bound to the combo box .... am I making sense here ? ...if so ...please help ....

Thank you in advance
 
I suspect that your terminology is a little muddled, as it is for many people starting out Access! The names and terms of Access is not always intuitive! Maybe this will help a little.

A combobox that retrieves the items it displays, such as a field from a table, is not said to be bound to the table. The table is the Row Source for the combobox.

Up until now, the combobox does not have a Control Source, and therefore is said to be an unbound combobox. You can use the combobox to do a number of things, such as insert data into textboxes on your form, utilizing its AfterUpdate event in the code module.

If you want the selection made in the combobox to be saved as part of the record in the form's underlying table, then in Design View, with the combobox selected, you would go to Properties - Data and use the Control Source property box to select the name of the field to save the selection to. The combobox is now said to be a bound combobox. Anytime that you return to this record, the combobox will display the selection you made for this record.

The simplest way to set the Default Value, again in Design View, with the combobox selected, go to Properties - Data and in the Default Value property box enter

ComboName.ItemData(0)

replacing ComboName with the actual name of your combobox.

Since the ItemData index is zero-based, this will cause the combobox to default to the first item. The second item would be ComboName.ItemData(1) and so forth.

You could also set the default in this same place, by actually entering the item you want to default to. If the item was "ABC Corporation" that's exactly what you would enter in the Default Value property box. Remember in this case to include the double quotation marks.

Good luck!
 
Last edited:

Users who are viewing this thread

Back
Top Bottom