Selecting Records to Print

Papa_Bear_1352

New member
Local time
Today, 18:42
Joined
Jun 16, 2003
Messages
9
Hi All

I have an access form with a list box containing a number of customers, column 0 being the customer ID. This list can show different customers depending on criteria that the user inputs and I select the records by building an SQL command. What I want to do is add a button to run a report for all the selected customers. the code at the moment is

stDocName = "RepStdLetter"

stCriteria = "CustomerID = " & Me.CustomerList.Column(0)

DoCmd.OpenReport stDocName, acPreview, , stCriteria

All I get is the customer last clicked in the list box, whether selecting or deselecting.

Thank You

Steve
 
You need to loop through the records and build the WHERE clause dynamically. Search here for multi select listbox or modify this code example provided by Mile-O
 
Is this sample something like what you're aiming for? It's in access 2000, not sure which version you are using.
 

Attachments

Users who are viewing this thread

Back
Top Bottom