Counter to count number of times a report's been printed

A

Adam

G'day,

I have VB code that once a Command button is clicked, it
produces a report on the VDU. As you know, you cannot put
a Print Command button on it... so if the report has to be
printed, we go to File>Print etc to get a print out.

When we print these reports, we want to have a counter
that counts the number of prints done. Is it possible to
do this may I ask?

I am using Access 2000.

Thanks for any assistance

Adam
 
M

Marty

If it were me I would create a macro to print the report
and in the same macro I would run an update query on a
table, say tblPrintCounter!Counter, Counter + 1.

Marty
 
A

Adam

....on the [report]...

The code is written so that the report will show on the
screen before being printed.

When originally developing the code, we used the Wizard.
The Wizard does not write code so that the report is
displayed first before it is printed. Instead it sends the
report straight through to the printer. So to stop this we
modified the Wizard's code to show the report first on the
screen then give the user the option of printing it using
the menu bar.

If you produce a report, Access does not allow the ability
to put a Command button on the report itself with code
that carries out an instruction like can be done on a form.
 
T

TC

I was pulling your leg :)

To answer your original question: "When we print these reports, we want to
have a counter that counts the number of prints done. Is it possible to do
this may I ask?"

If you are doing the prints from a toolbar button, just have the button
include some code to increment a counter field in a suitable table. For
example, say you had this table:

tblReportCounts
ReportName (PK)
PrintCount (number, default value 0)

Say you initialized the table with a record for each report name. Then, the
toolbar button code could do something like:

dbengine(0)(0).execute "UPDATE tblReportCounts SET PrintCount = PrintCount +
1 WHERE ReportName = """ & report.name & """", dbfailonerror

If report.name did not work in the context where you ran that statement,
just code-in the report name:

.... WHERE ReportName = ""rptMyAmazingReport""", ...

Then you could display the current print counts from that table, whenever
you wanted.

HTH,
TC


Adam said:
...on the [report]...

The code is written so that the report will show on the
screen before being printed.

When originally developing the code, we used the Wizard.
The Wizard does not write code so that the report is
displayed first before it is printed. Instead it sends the
report straight through to the printer. So to stop this we
modified the Wizard's code to show the report first on the
screen then give the user the option of printing it using
the menu bar.

If you produce a report, Access does not allow the ability
to put a Command button on the report itself with code
that carries out an instruction like can be done on a form.

-----Original Message-----
You are correct. You can not put a Print command button on the VDU !!

HTH,
TC





.
 

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