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

Multi Listbox select query

Status
Not open for further replies.

GooGoocluster

Technical User
May 12, 2005
71
US
I trying to make a form with a multi select listbox choose my criteria for a query.

For instance

I select Some location code from a list box then click a button that updates a query to use for other things like reports, forms ect.


Another question I may have to ask this in a seperate thread. I used the label wizard to make a report. Is there a way to duplicate records on a report. For instance I have one label that I want 8 duplicates of ON one sheet.
So I can print 1 page of the exact same label.
 
Simplest solution: you can enter parameters in the underlying query which point to the listbox on the form, however this requires the form to be open every time the query is run and a selection in the listbox made, for the query to work. e.g. [Forms!MyForm!MyControl] where MyForm and MyControl are the names of the form and the listbox.

More complex solutions involve dynamically building SQL, or creating QueryDefs with VBA behind the form, and it depends how comfortable you are with coding as to whether you want to take this on.

Not used the label wizard, but presumably the output is based on a query or table? If you're using a table, create a query based on the table, then build into it a table with 8 records (doesn't matter what they are, create a static table specifically for the job), but crucially NOT linked to any other table in the query. This will give you a cartesian product with 8 duplications of each row of your addressees. Then run the label wizard, and base it on this query.

Laters, Z

"42??? We're going to get lynched!
 
Check out this FAQ faq181-5497 It contains a function that will create and return the Where clause for you (without the word Where). It works for single and multi-select list boxes, combo boxes, text boxes, date ranges, option groups and check boxes. You only have to do 3 things to make it work.

1. Create a new module and copy the functions from the FAQ and paste them into the new module. (Don't worry if you don't understand the code. Just read the documentation and use the function.)
2. Define the tag propery for each of your list boxes as specified in the FAQ.
3. Open your report (or filter your form) as specified in the FAQ.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top