This is the code to grab a single selected item for a ListBox and pass it to another open form.
You change the control names to match yours and the column number you want to pass.
Requirements - Both forms need to be opened.
Note: vSelected is an Integer
[CODE=vb]
' store the Index Array number for the List Box selection row
vSelected = Me.lstPickFrom. ListIndex
' pass the 1st column (0 based) of the list box (lstPickFrom) to another open form
Forms!frmReceiv e.txtReceive.Va lue = Me.lstPickFrom. Column(1, vSelected)
[/CODE]
Originally posted by Codebug
I have a List Box on a form and the RowSource SQL is set in VB to display field data from a table.
How do I pass field data from the users selected row?
in the new form goto textbox properties > data tab
default value = [Forms]![your_form]![your_control]
programatically maybe docmd.open method ,, stlinkcriteria method
Comment