How to Select the first record in a combo box

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
 
R

Rick Brandt

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.
 
J

Jim McDonald

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
 
R

Rick Brandt

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.
 

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