Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

runtime error 451 form not reading listbox 1

Status
Not open for further replies.

vba317

Programmer
Mar 5, 2009
708
0
0
US
I have forgotten how to read a value from a listbox. I am hoping for some assistance. I have a form called frmImport. I have a listbox on the form called lbox1. I have a button on the form called cmdImport. When I click on the button I want to pass the value from the list box into a module called ImportAR_CS. My listbox is based on a table and it is populated with the values I expect. I have tried 3 or 4 combinations of the me! statement with no luck. Depending on which statement I use I either get an error 2465,438 or 431. Any help would be greatly appreciated.

This is the code behind the button
Code:
Private Sub cmdImport_Click()
Dim strLbox1 As String
Dim strClientName As String
'Me!frmImport!lbox1.Column(1) = Me!cmdImport
'Me!cmdImport = Me!frmImport!lbox1.Column(1)
'Me!cmdImport = Me!lbox1.Column(1)
Me!lbox1.Column(1) = Me!cmdImport
Debug.Print lbox1
Debug.Print strClientName

Call ImportAR_CS(strClientName)
End Sub
 
I'd try this:
Private Sub cmdImport_Click()
ImportAR_CS Me!lbox1.Value
End Sub

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top