Using list box to disply related fields

JSRhone

New member
Local time
Today, 03:17
Joined
Apr 26, 2002
Messages
8
In a form I have a List Box from a query named Countries and the fields from the query also. I would like to be able to double click on a country’s name in the List Box and have the related fields appear for that record.

Can anyone help me with the VBA for this.

Thanks Joanne
 
Sub ListBoxName_AfterUpdate()
' Find the record that matches the control.
Me.RecordsetClone.FindFirst "[FIELD] = '" & Me![ListBoxName] & "'"
Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

Notes:
Ensure the bound column in the listbox is the primary key value(regardless of whether it is visible or not)
If the primary key value is not text remove the "'"'s around Me![ListBoxName] above as these only apply as text qualifiers.
 

Users who are viewing this thread

Back
Top Bottom