How to copy the first item in the listbox to a text box?

S

she

I have a listbox called list1 and two textbox called txt1, and txt2.

How do I copy the first listitem to txt1 and the second listitem to txt2 in
MS Access?

Thank you!
 
B

Brendan Reynolds

Private Sub Command6_Click()

Me.Text2 = Me.List0.ItemData(0)
Me.Text4 = Me.List0.ItemData(1)

End Sub

.... where 'Text2' and 'Text4' are the names of your text boxes, and 'List0'
is the name of your list box.

Just remember that ItemData is zero-based, so the first item is ItemData(0),
the second is ItemData(1), etc.
 
Top