Link to home
Create AccountLog in
Avatar of Gary2397
Gary2397

asked on

Open Access Report and Pass Criteria for Query

I am using VB.net and Visual Studio 2003. I need to open an Access report and provide criteria for a query or for a report. For instance, I want to open a report and pass a customer ID to the query that generates the report. Is this possible?
ASKER CERTIFIED SOLUTION
Avatar of iboutchkine
iboutchkine

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of Gary2397
Gary2397

ASKER

Another choice is to create query on the fly and then open report based on this query.........

This is great and I think exactly what I am looking for. But, in the code, I don't see where you are relating the report with the dynamic query. When I create a report, in the Access designer, it is based on a query or table. How will I relate the report to your dynamic query.

Thanks, in advance.
Let's say that you creat a query qryABC and then build the report based on this query

Now in the code you
1.Delete query
2.Create the query with different parameter
3.Call report


Of course the new query has to have the same fields that you used in the report

In the code above I showed you how to crate a query

Let me know if you haver any questions
Thank you so much. Great answers and quick response.