Report out of a listbox

damdoumaa

Registered User.
Local time
Yesterday, 22:29
Joined
Apr 23, 2004
Messages
16
I have a search form that allows the user to search a contact database and obtains contactId, FirstName, LastName and CompanyName the obtained records are placed into a listbox (lstResult)

I want to add a button that would open a report that cotains only the records that are in the listbox (lstResult).
How do I do that?
Please help.
 
This is not the answer I was looking for. I think my question was much more basic.

I have a listbox that contains values based on a search.
I have another button that should open a report that contains only the records inside the listbox.
I created a report that displays all the records in the contacts table "Alphabetical Contact Listing".

On the "Onclick" event of the button i have this code:


stDocName = "Alphabetical Contact Listing"

DoCmd.OpenReport stDocName, acPreview, , [ContactID] = Me.lstContactInfo.ControlSource


I know that the filter or the where condition should be fixed so that I obtain the report that I want. What should I do?
 
d,

If the ID is the first column on your list box:

Code:
stDocName = "Alphabetical Contact Listing"
DoCmd.OpenReport stDocName, acPreview, , "[ContactID] = " & Me.lstContactInfo

Otherwise:

Code:
stDocName = "Alphabetical Contact Listing"
DoCmd.OpenReport stDocName, acPreview, , "[ContactID] = " & Me.lstContactInfo.Column(0)

The subscript varies from 0 to how many columns in your select.

This is not for a multi-select listbox.

Wayne
 

Users who are viewing this thread

Back
Top Bottom