Manipulating Data from a List Box

music_al

Registered User.
Local time
Today, 16:35
Joined
Nov 23, 2007
Messages
200
Hi,

I have a list box with 3 columns and several items in the list. When I double click a particular item, I want it to launch the form related to that item. The same form will be used for all items, I just want the the form to open with the appropriate record filtered.

I am happy that I need to embed this in the Control's Double-Click event, but not sur ehow to extract the data from the list box.

Thanks in advance

Al
 
Put the following code in the double click event for the list box:

Code:
dim stDocName as String
dim stLinkCriteria as String
 
stDocName = "YourFormName"
stLinkCriteria = "[LinkingField] = " & Me.ListBoxName
DoCmd.OpenForm stDocName, , , stLinkCriteria

This assumes that the field that you want to link from the list box is the bound column. Make sure you replace the [LinkingField], ListBoxName and YourFormName with the objects in your database.
 
In addition to the above you can also refer to other columns in the list box by referring ot the actual columns.

Such as: Myfield = Me.MyListbox.Column(3)

Remember that columns in both listboxes and combo boxes are zero based.

David
 

Users who are viewing this thread

Back
Top Bottom