Unbound ComboBox initial display

L

Lara

When a form opens, I want an unbound combo box to
automatically select a particular item from the list
(such as the one that matches the value in another
field), then allow the user to change that selection. My
VBA for Access is more than a little weak! How do I do
this?
 
W

Wayne Morgan

If you want the combo box to be set to a certain row, you could use the column property.

Me.cboMyCombo = Me.cboMyCombo(0,1)

This would set the value of the combo box to the value in column 1, row 2 (the numbers are
zero based). The column you pick should be the bound column number -1.

To set the combo box to the value of another control

Me.cboMyCombo = Me.txtMyTextbox

To do this each time you move from one record to another, you would do this in the Form's
OnCurrent event.
 

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