Multiple Reports

G

Guest

I need to print a number of reports as a single job. The reports are to be
selected in turn according to the values of one of the 2 fields returned in a
select query. Another query provides data for the reports, and this query
needs the current values of both fields in the select query. If it helps,
the details are as follows:

The select query returns 2 fields - the first is called Component (has
values like 0568/06, 0595/02) and the other is called Centre (has values like
BW800, BW801). I also have a set of reports named 0568/06, 0595/02, etc. ie
with names which are the same as the possible values of the Component field
in the select query. When I run the select query, I need to open the report
with the same name as the first value of the Component field in the query ie
if the query returns 0568/06 as the first value, I need to open the report
named 0568/06. In addition, the query providing data to the report needs the
current values of Component and Centre from the select query. I then need to
repeat the process for the next record in the select query and so on until
the last record is reach.

Having tried to describe the problem, this suddenly seems a very odd way of
doing things. Is there any future in this approach, or shall I try something
different?

Thanks for any help

Jim Jones
 
G

Guest

Jim,
You could do it with ADO code. Here is some sample code that you can try to
fiddle with:
dim rsReports as adodb.recordset
dim stDocName as string
dim stSQL as string

set rsReports = new adodb.recorset
rsReports.activeconnection = currentproject.connection
rsReports.cursortype = adForwardOnly
rsReports.locktype = adLockOptimistic

stSQL = "Select * from qryYourQuery"

rsReports.open ssql

do while not rsReports.eof
stdocname = rsReports![YourField] & rsRports![YourOtherField]
docmd.open stdocname
loop
 

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