Combo box listindex <> recordset on first afterupdate event

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

Marshall Barton

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)
 
G

Guest

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

Marshall Barton

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

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