Want to create seperate PDF's for multiple "EventCodes"

  • Thread starter JoeG via AccessMonster.com
  • Start date
J

JoeG via AccessMonster.com

I have a room scheduling database, SQL and links through Access 2007. The
EVENT CODE ties all booking information together such as customer, rooms,
dates and times.

I have a form, tied to a query, that gives me all the active EVENT CODES with
a checkbox so I can select the ones I want to run a report on.

I also have a report, tied to another query that pulls the details for a
EVENT CODE.

Running the report works fine as long as I choose only one EVENT CODE at a
time. When choosing multiple EVENT CODES I end up with one large report
rather than a seperate report for each event code.

Can someone tell me how to set up a loop so that a seperate report is
generated for each EVENT CODE? Or is looping not the way to address this?
 
P

PieterLinden via AccessMonster.com

It would probably be easier to code if you allowed the user to choose which
Event Codes to select from in a Multi-Select Listbox, because then you can
loop through the .ItemsSelected collection one at a time, and run/print a
filtered report for each item.

Something like:

Private Sub cmdProcessSelectedItems_Click()
Dim varItem As Variant

For Each varItem In Me.mslbxItemCodes.ItemsSelected
DoCmd.OpenReport "MyReport", acViewPreview, , "[EventCode]='" & Me.
mslbxItemCodes.ItemData(varItem) & "'"
Next varItem

End Sub

As long as you set the Multi-Select property of the listbox to something
other than None, this will work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top