One Report based in two distinct queries (?)

G

Guest

Hello!
I have a Form with two command buttons.
cmd1 to open Report1 based in Query1
cmd2 to open Report2 based in Query2

I would like with same Report to show the data of the Query1 or Query2,
consonant the button clicked.

Is it possible in Access2k, please.
Thanks in advance.
an
 
G

Guest

Create a Global Variable in a module, so you can assign the name of the query
to it

Global QueryName As String

Before you run the report assign the query name to the report

QueryName = "Query1"
Docmd.OpenReport "ReportName"
==========================
On the OnOpen event of the report set the record source of the report with
the name of the query

Me.RecordSource = "SELECT * FROM " & QueryName
===========================
In Access 2003 you could have passed the name of the query using the
OpenArgs, but as much as I can remember Access2000 doesn't have OpenArgs in
the report
 
G

Guest

O,

Excuse me for the delay that if must to the hours of attempts, without
success.
Tomorrow I will continue...
Debtor for the aid
an
 

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