Print Log for Access 2000

A

akroes

Using Access 2000, I want to add a note to certain records of m
database when they are printed so that duplicate prints are not made.
Also serves as a log to say 'well, you printed that on...'. I hav
code that does this, and works fine, but *when* to run it is the issue


I know about the onPrint event, but it fires when the report i
previewed also. I want the users to be able to preview the report, bu
only add the timestamp to the records the report is based on if the
are *really* printed. I can't find an event for that.

I did a long search of the Internet, and I did find a knowledge Bas
article (154894) that does *exactly* what I want, but it is for Acces
97 and older, but it doesn't sem to work properly in 2000 (or the way
implemented it!)

Any ideas? Thanks
 
M

Marshall Barton

akroes said:
Using Access 2000, I want to add a note to certain records of my
database when they are printed so that duplicate prints are not made.
Also serves as a log to say 'well, you printed that on...'. I have
code that does this, and works fine, but *when* to run it is the issue.


I know about the onPrint event, but it fires when the report is
previewed also. I want the users to be able to preview the report, but
only add the timestamp to the records the report is based on if they
are *really* printed. I can't find an event for that.

I did a long search of the Internet, and I did find a knowledge Base
article (154894) that does *exactly* what I want, but it is for Access
97 and older, but it doesn't sem to work properly in 2000 (or the way I
implemented it!)


The code in that article should work as advertised in any
version of Access, unless you have your references set up
differently than expected. If you're using ADO (or just
have an unused reference set for ADO), then you need to make
sure you have a reference to DAO and disambiguate the object
declarations:

Dim dbs As DAO.Database, rst As DAO.Recordset

Note that this code will only tell you that a user requested
a printout of the report. It can not tell you if the report
was actually printed, or, if it did get to the printer, that
the result was usable (out of ink, paper jam, picked up by
wrong person, etc).
 
A

akroes

Thanks for the Reply, Marsh, but I am still having difficulties.

I tried the explicit DAO statements as you mentioned, but still hav
the same problem - the printed date/time is entered into the table jus
fine, but it is *always* entered, even when the report is just opene
in print preview.

What I need is to document the date/time when the report is actuall
sent to the printer, not when only previewed.

I have Northwind.mdb modified word for word per the article (except th
rem statements). I also have my own modified version in my databas
that stamps the print date/time on each record in the report. The
both have the same problem - they always stamp, even when in prin
preview, which the article says shoudn't happen...

I even tried only a msgbox in the if-then statement where it shoul
stamp, and it always stamps. The msgbox actually pops up before th
report even shows on the screen in preview mode, so it is stamping i
before I even have the ability to print it.

While valid, I am not worried about the other issues you mention (yet!
like printer out of ink, paper jam, etc that would keep a print fro
getting into the right hands. The fact that they tried is enough fo
now.

Any further ideas?

Anthony J. Kroe
 
M

Marshall Barton

akroes said:
Thanks for the Reply, Marsh, but I am still having difficulties.

I tried the explicit DAO statements as you mentioned, but still have
the same problem - the printed date/time is entered into the table just
fine, but it is *always* entered, even when the report is just opened
in print preview.

What I need is to document the date/time when the report is actually
sent to the printer, not when only previewed.

I have Northwind.mdb modified word for word per the article (except the
rem statements). I also have my own modified version in my database
that stamps the print date/time on each record in the report. They
both have the same problem - they always stamp, even when in print
preview, which the article says shoudn't happen...

I even tried only a msgbox in the if-then statement where it should
stamp, and it always stamps. The msgbox actually pops up before the
report even shows on the screen in preview mode, so it is stamping it
before I even have the ability to print it.


Well, I'm finding that article to be difficult to unravel
myself. I guess I just don't think the Deactivate event is
a reliable way to determine whatever they think they're
using it for??

Let's start over from scratch and try something easier(?).

In the report module's declaration section (before any
procedures), add the line:

Dim bolPreview As Boolean

Then in the report's Activate event, add a line of code:

bolPreview = True

Now you can use this logic in a print event:

If Not bolPreview Then
' set record printed indicator
MsgBox "record printed :" & Me.txtrecordID
End If

Note that you will not be able to determine if a user
previews the report and then uses a menu or toolbar button
to print the report from the preview window.

The way I usually handle this kind of situation is to have
both a Print and a Preview button on the form that is used
to initiate the report. The Print button sets the
DatePrinted field for the record(s?) to be printed. The
report checks this field and makes a label control visible
or not if this date field is or isn't Null. The label
control just has the word "Draft" in light gray using a 36
point font. This way users can print out draft copies of
the report from the preview window, but once they use the
Print button to print the report, the data record has an
indicator that tells you when an "official" print was done.
 
Top