Update a table after printing

  • Thread starter Thread starter Jasper Recto
  • Start date Start date
J

Jasper Recto

We have a table that has one field that is used to identify if that record
has been printed.

Currently, we have a query that identifies all records that don't have the
'Printed' option checked.

If it does not, the users prints a report for each record and then goes back
into the database to check off the printed option.

I would like to create a button on a form that would print out a report for
each record that is not checked off.

AND THEN, I would like the record to be checked off automatically. This
way, when the report is run, it only prints the records that do not have the
printed option checked of.

Is this possible to do?

Any ideas?

Thanks,
Jasper
 
Hi Jasper

It's easy to tell that a report has been opened, but it is not easy to tell
that it has been printer successfully. Was there a paper jam? Was the
report deleted from the print queue before it completed printing?

For that reason, I recommend that the user be required to make a conscious
decision to mark the records as "printed".

You could use the Close event of the report to ask the user:

Private Sub Report_Close()
Dim strMsg as string
Dim strSQL as string
strMsg = "Do you want to mark all records as 'printed'?"
If MsgBox( strMsg, vbYesNo Or vbQuestion) = vbYes Then
strSQL = "Update YourTable set Printed=True where Printed=False"
CurrentDb.Execute strSQL, dbFailOnError
End If
End Sub
 
Jasper

Before you pursue this to the end, consider the following scenario:

A user selects a record from the not-printed set and sends it to the printer
with the click of a button.

That same button click also updates that record's [Printed] field to show
that it was printed.

Unfortunately, after Access sent the print job off, something bad happened:
* the network hiccupped, losing the print job
* the printer hiccupped, losing the print job
* the printer ran out of toner, but tried "printing" anyway, producing
mostly blank paper
* (I think you get the idea)

I'm not aware of a way that Access can inspect the output of a printer to be
sure the print job actually printed. I believe that requires USB (using
someone's brain).

Perhaps another approach is called for? What if a list of all items sent to
print were maintained, and the user had to do one final button push to say
"Yes, all these were successfully printed"?


Regards



Jeff Boyce

Microsoft Office/Access MVP
 
Back
Top