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

Multilistbox parameter for query

Status
Not open for further replies.

Seeff

Programmer
Dec 2, 2002
33
IL
I have a form with a listbox. I would the user to pick one or more values and have these values serve as criteria for a query.

Any ideas? Thanks in advance!
 
This is the code that I use.

This will show what is selected in a list box. This will only show the bound column value.

Set ctl = Forms!frmSelection!lstSecMatching

For Each varItem In ctl.ItemsSelected
txt = ctl.ItemData(varItem)
MsgBox txt
Next varItem
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


This will give you the option of showing other columns besides the bound column.

For Each varItm In ctlF.ItemsSelected
lngMatchId = ctlF.Column(0, varItm)
Next varItm

You want to make an array that holds all of the info that you selected because this just show individual selections without saving them anywhere. Let me know if you need any more help.

cainebean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top