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!

Form Question

Status
Not open for further replies.

peciam

Programmer
Aug 3, 2006
44
0
0
US
Hi,

The user has changed/added more items to what I thought was a completed item.

Here's the setup:

Form was designed to select a Office, using a listbox from a table.

Same form they added a listbox for jobtable, linked again to a table.

There is a seperate report for each job title, 12 in total.
They want to select some or all the reports depending on the selection from the form, remember that is 12 different reports and then only include data for items(offices) selected from the form.

Here's my code some far:

Private Sub OK_Click()
On Error GoTo err_preview_report_click
Dim title, wclause, RO, rname

For Each RO In Me![Ro_list].ItemsSelected
rname = Me![Ro_list].ItemData(RO)
Next

For Each title In Me![report_list].ItemsSelected
wclause = Me![report_list].ItemData(title)
DoCmd.OpenReport reportname:=wclause, view:=acViewPreview
Next
Mereport_list = ""
Me.[Ro_list] = ""

EXIT_OK_CLICK:
Exit Sub

err_preview_report_click:
MsgBox "Select a report!"
Resume EXIT_OK_CLICK

End Sub

The reports are based on queries:

I have this in the queries:
Like [forms]![frm_srp_sal_ro]![ro_list] & "*"
Each report has a seperate query.

Any thoughts much appreciated.




 
Hi,

Sorry, it would help if I did ask a question.

I want to allow the user to select the office(s), one or many or all. Then allow them to run one report or many, or all the reports. The reports would be only for the offices selected and the reports selected.

TC
 
If I understand correctly your question is
"How do I use a multi select listbox to define the criteria for a query?"
If that is the case see
faq701-6099
faq701-4432

 
Peciam--Try out the links MajP suggested, then let us know if you still need help (tell us with what you've tried and what is working or not working). Thanks.

Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244. Basics at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top