Combo box listindex <> recordset on first afterupdate event

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In Access 2003, I added a combo box to a new form (Combo0), set the Row
Source to a table and then added this afterupdate event.

Private Sub Combo0_AfterUpdate()
MsgBox (Combo0.ListIndex & " - " & Combo0.Recordset.Fields.Item(0).Value)
End Sub

The first time I click on an item, the record set ALWAYS returns the first
item. Then it works fine.
 
Ken said:
In Access 2003, I added a combo box to a new form (Combo0), set the Row
Source to a table and then added this afterupdate event.

Private Sub Combo0_AfterUpdate()
MsgBox (Combo0.ListIndex & " - " & Combo0.Recordset.Fields.Item(0).Value)
End Sub

The first time I click on an item, the record set ALWAYS returns the first
item. Then it works fine.


Having never used that construct, I won't try to explain
what's happening.

However, won't this more common expression do what you want?

. . . & Combo0.Column(0)
 
Thanks for your response - Since my posting, I learned of this as well - but
still the same results.

The first time I select an item from the combo box, the column property is
always the first record, even though the listindex and the value (bound
column) are the proper items I selected. All subsequent selections are
proper.
 
I have never seen that kind of behavior so I have to wonder
if there is either of two things going on here. Maybe you
have some other code somewhere that's interfering or maybe
there is something wrong with the form??

I am definitely grasping at straws now, but you might try
creating a new form to test this out in a simple situation.
If that works, then, lacking a coding conflict, I would
presume that the problem form is messed up and should be
recreated (Copy/Paste is your friend).
 
Back
Top