Values from list box to report

damdoumaa

Registered User.
Local time
Today, 10:12
Joined
Apr 23, 2004
Messages
16
Hello,

I have a contact database. On the search form, I have 2 text boxes to allow the user to search by firstname &/or last name. After enterting the search criteria, the user should press a button so that all the records that meet the search criteria appear in a list box. I did that by doing a query "strSQL" and applying it to the list box. Everything works fine.

I also created a report that takes all the records from the contacts table.

I have another button on my form that should open this report filtering the records available in the list box. I know that I already have the query "strSQL", and I tried to open the report by typing in the OnClick Event of the button:

DoCmd.OpenReport stDocName, acPreview, strSQL

But the report keep on showing me all the records in the contacts table.

Please help!
 
I won't claim to be an expert in SQL, but according to my experience an SQL statement can have a lot of different sections. According to Access Help, "A string expression that's a valid SQL WHERE clause without the word WHERE." Is it possible you attempting to provide more than what Access report generator needs or wants. Just a thought. jt
 

Users who are viewing this thread

Back
Top Bottom