changing Combo Box dispalyed value

T

Tom

I have a table that list job records, about 6,000 entries in the form below

JobRec Customer
1 ABC
2 BCD
3 CDE
4 DEF
etc

I have a form with a combo box that displays the JobRec that will then
display the info for the job number in the various fields of the form.
I have a navigation button to increment the JobRec by one so that I can move
through the records and update the fields on the form and this works fine.
I would like the displayed value in the combo box to match the current
record being displayed.
I can get the ListIndex from the combo box and it will be for example 2, if
I increment this by one I would like to then set the combo box displayed
value to 3.
ListIndex is however, read only so me.combo3.listindex+1 does not work.

Is it possible to have the combo box displayed value track the record number
being incremented by the navigation button?
 
G

Graham Mandeno

Hi Tom

You can set ListIndex in code provided the listbox or combobox has the
focus. So:

With Me.combo3
.SetFocus
If .ListIndex < .ListCount - 1 Then
.ListIndex = .ListIndex + 1
End If
End With
 

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