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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using Listbox as control 1

Status
Not open for further replies.

freefour

MIS
Joined
Aug 26, 2004
Messages
33
Location
US
I have a listbox that outputs some invoice data. I want to use the first column of the selected row to open another form.

I know how to do it with a combo box:

Dim stlinkcriteria As String
Dim stDocName As String

stDocName = "frmEditVehicle"

stlinkcriteria = "[VehicleID]=" & Me.CmbVehicle.Column(0,0)
DoCmd.Close acForm, "Customer"
DoCmd.OpenForm stDocName, , , stlinkcriteria
DoCmd.Restore

Works great, but how can I use a Listbox with the same type thing where it will say:

Me.LstVehicle.Column(SELECTED COLUMN,0) ?

How can I tell my criteria statement to equal whichever column that is selected number?

Thanks for you help!

--freefour
 
Your combobox sample will give the first column in the first row.

To get the first column of the selected item, it's, if the first column is also the bound column, it's sufficient using the listbox name in the reference:

[tt]Me.LstVehicle[/tt]

else (if the first column isn't the bound column), use

[tt]Me.LstVehicle.column(0)[/tt]

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top