combo box recordset question

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 select an item from the combo box, the record set ALWAYS
returns the first record even though the listindex is correct. Then it works
fine.
 
D

Douglas J. Steele

Why are you referring to the combobox's Recordset?

MsgBox (Combo0.ListIndex & " - " & Combo0.Value)

will give you the correct information.
 
G

Guest

I have mulitple fields that I want to display on the form when a user selects
from the combo box. Not just the bound column.

What is the proper way? Do a find on the refereneced table or ???
 
D

Douglas J. Steele

Combo0.Column(1) will show you the value of the 2nd column of the currently
selected row (the Column count is 0 based)
 
G

Guest

I get the identical information with the column property.

MsgBox Combo0.Recordset.Fields.Item(1).Value & " = " & Combo0.Column(1)

The issue is that the first time the combo is selected - it always returns
the first record, even though the listindex and the value of the combo box
return the proper record info.

Any subsequent selections return the proper information.
 

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