How do I populate a field on a form using a selection listbox?

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

Guest

I populate a listbox in a form with fields from a table. I want the user to
select a record from the list and have the primary key from the table to be
put in a field (same format, etc.) on the form which will then populate a new
record in another table with a foreign key back to the table from the
listbox.
 
Assuming the PK is the listbox's first column, the following will do it:

Private Sub MyList_Click()
If Not IsNull(Me.MyList) Then
Me.txtMyTextbox = Me.MyList.Column(0)
End If
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
Back
Top