A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Capturing when a report is printed



 
 
Thread Tools Display Modes
  #1  
Old July 25th, 2007, 04:55 PM posted to microsoft.public.access.reports
davea
external usenet poster
 
Posts: 18
Default Capturing when a report is printed

I'm trying to record the date and time when a particular report is
actually printed. I have seen methods on the groups for recording when
a report is previewed e.g. using activate and deactivate events on the
report. I currently have a table that records a date and time for the
report but it also records it when you preview and close the report
without printing. Here's the code I'm using:

Sub ReportHeader3_Print (Cancel As Integer, PrintCount As Integer)
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDB()
Set rst = dbs.OpenRecordset("tblPrintedReports")
Flag = Flag + 1
' If the current value of Flag = 1, then a hard copy of the
' report is printing, so add a new record to the history table.
If Flag = 1 Then
rst.AddNew
rst!ReportName = "rptCustomers"
rst!PrintDate = Now
rst.Update
Flag = 0
End If
End Sub

How do you capture when a report has been printed? Any suggestions
welcome.

  #2  
Old July 25th, 2007, 05:23 PM posted to microsoft.public.access.reports
fredg
external usenet poster
 
Posts: 4,386
Default Capturing when a report is printed


http://www.groups.google.com is your friend. Use it.
You can use the following code to determine if the report has been
sent to the printer, whether or not it has also been previewed.

HOWEVER... Even if it has been sent to the printer, there is no way to
tell if the printout has been successfully printed until you have the paper
report in your hand.

The actual starting value of intPreview below depends upon if you have
a control in the report to compute [pages].
Comment out the un-needed portion of the code accordingly.


Option Compare Database
Option Explicit
Dim intPreview As Integer


Private Sub Report_Activate()
intPreview = -1 ' If [Pages] is not used
' intPreview = -2 ' If [Pages] used
End Sub


Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
If intPreview = 0 Then ' If [Pages] not used
' If intPreview = 1 Then ' If [Pages] used
MsgBox "Gone Printing"
' You can place code here to update a table field to show it was
sent to printer
End If
intPreview = intPreview + 1
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail



"davea" wrote in message
oups.com...
I'm trying to record the date and time when a particular report is
actually printed. I have seen methods on the groups for recording when
a report is previewed e.g. using activate and deactivate events on the
report. I currently have a table that records a date and time for the
report but it also records it when you preview and close the report
without printing. Here's the code I'm using:

Sub ReportHeader3_Print (Cancel As Integer, PrintCount As Integer)
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDB()
Set rst = dbs.OpenRecordset("tblPrintedReports")
Flag = Flag + 1
' If the current value of Flag = 1, then a hard copy of the
' report is printing, so add a new record to the history table.
If Flag = 1 Then
rst.AddNew
rst!ReportName = "rptCustomers"
rst!PrintDate = Now
rst.Update
Flag = 0
End If
End Sub

How do you capture when a report has been printed? Any suggestions
welcome.



  #3  
Old July 26th, 2007, 10:40 AM posted to microsoft.public.access.reports
davea
external usenet poster
 
Posts: 18
Default Capturing when a report is printed

On 25 Jul, 17:23, "fredg" wrote:
http://www.groups.google.com is your friend. Use it.
You can use the following code to determine if the report has been
sent to the printer, whether or not it has also been previewed.

HOWEVER... Even if it has been sent to the printer, there is no way to
tell if the printout has been successfully printed until you have the paper
report in your hand.

The actual starting value of intPreview below depends upon if you have
a control in the report to compute [pages].
Comment out the un-needed portion of the code accordingly.

Option Compare Database
Option Explicit
Dim intPreview As Integer

Private Sub Report_Activate()
intPreview = -1 ' If [Pages] is not used
' intPreview = -2 ' If [Pages] used
End Sub

Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As
Integer)
If intPreview = 0 Then ' If [Pages] not used
' If intPreview = 1 Then ' If [Pages] used
MsgBox "Gone Printing"
' You can place code here to update a table field to show it was
sent to printer
End If
intPreview = intPreview + 1
End Sub
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

"davea" wrote in message

oups.com...



I'm trying to record the date and time when a particular report is
actually printed. I have seen methods on the groups for recording when
a report is previewed e.g. using activate and deactivate events on the
report. I currently have a table that records a date and time for the
report but it also records it when you preview and close the report
without printing. Here's the code I'm using:


Sub ReportHeader3_Print (Cancel As Integer, PrintCount As Integer)
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDB()
Set rst = dbs.OpenRecordset("tblPrintedReports")
Flag = Flag + 1
' If the current value of Flag = 1, then a hard copy of the
' report is printing, so add a new record to the history table.
If Flag = 1 Then
rst.AddNew
rst!ReportName = "rptCustomers"
rst!PrintDate = Now
rst.Update
Flag = 0
End If
End Sub


How do you capture when a report has been printed? Any suggestions
welcome.- Hide quoted text -


- Show quoted text -


Excellent! That worked perfectly! Thanks a lot, I've been searching
for a solution to this for ages!

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.