Pass id from list box to new form

scheeps

Registered User.
Local time
Today, 21:13
Joined
Mar 10, 2011
Messages
82
I need to pass an id from a list box to a form as soon as the user double click on a record in the list box.

I've tried the following on the DblClick event:

Code:
Const FN As String = "frmConversion_Factor"
DoCmd.OpenForm FN, , , , , , Me.lstConversionFactor.ItemData(1)

If i place a breakpoint on the last line, the id do appear in the mouse over. But on the new form the OpenArgs value contains the field name and not the id as it appear in the breakpoint mouse over.

What am I doing wrong here?
 
Try;
Code:
Const FN As String = "frmConversion_Factor"
DoCmd.OpenForm FN, , , , , , Me.lstConversionFactor.Column([B][COLOR="red"]X[/COLOR][/B])
Where X is the column number that holds your ID number. Rembers that the columns in Listboxes and combos are numbered from zero up. If it is column zero that hold the value you can simply use Me.lstConversionFactor
 
Thanks John, it is working perfectly with .Column(0).
 

Users who are viewing this thread

Back
Top Bottom