ComboBox Default Values

M

Michael Volz

To All on MSDN Discussion Forum:

I have a combobox that I am trying to populate from the
query that is the rowsource of the combobox. The Access
help says to type in "the combobox name.ItemData(n)" where
n is the index value of the row of table or query where
the data is being retrieved from. I am changing the value
of n in the above expression but the default value is
always blank in the combobox. Is there additional code
that needs to be added such as in the Form_Load or
Form_Open event? Does another property of the combobox
have to be changed in order for this to work?

Any help or hints on this topic would be greatly
appreciated. Thanks in advance.
 
D

Dirk Goldgar

Michael Volz said:
To All on MSDN Discussion Forum:

I have a combobox that I am trying to populate from the
query that is the rowsource of the combobox. The Access
help says to type in "the combobox name.ItemData(n)" where
n is the index value of the row of table or query where
the data is being retrieved from. I am changing the value
of n in the above expression but the default value is
always blank in the combobox. Is there additional code
that needs to be added such as in the Form_Load or
Form_Open event? Does another property of the combobox
have to be changed in order for this to work?

Any help or hints on this topic would be greatly
appreciated. Thanks in advance.

What do you mean by "populate"? Do you mean you want to set the combo
box's Value? Or its Default Value? Or something else?

If you're using code, could you post the code you're using? Something
like this should work in the form's Open event:

Me!Combo0.DefaultValue = _
"""" & Me!Combo0.ItemData(0) & """"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top