How to Select the first record in a combo box

  • Thread starter Thread starter cathy
  • Start date Start date
C

cathy

I have a combox box which looks up other records.

It works fine. But I want the combo box to display the
value of the field when it first opens. Right now, it is
blank so I cannot see the value of the first record for
that field.

I have tried setting the listindex property of the combo
box to 0, but it is not working.

Thanks

Cathy
 
cathy said:
I have a combox box which looks up other records.

It works fine. But I want the combo box to display the
value of the field when it first opens. Right now, it is
blank so I cannot see the value of the first record for
that field.

What field? Combos used for navigating or filtering should not be bound to any
field. I would place another TextBox on the form to display the field that the
ComboBox is searching on instead of trying to get the ComboBox to pull double-duty.
Change the label of the Combo to "Go To..." or similar so it is obvious to the user
that it is a search tool and not part of the record.
 
Cathy:
Presuming the bound col is 1, try this, in the form_onCurrent or OnOpen or
somewhere convenient:

Combo1 = Combo1.Column(0, 0)

best luck

Jimbo
 
Jim McDonald said:
Cathy:
Presuming the bound col is 1, try this, in the form_onCurrent or OnOpen or
somewhere convenient:

Combo1 = Combo1.Column(0, 0)

Wouldn't that be based on the assumption that the rows in the ComboBox have the same
sort/filter as the rows in the Form's RecordSource? If the very first choice doesn't
correspond to the first record on the form then it could be problematic.
 
Back
Top