Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Differentiate between "Print" and "Preview"

Status
Not open for further replies.

straybullet

IS-IT--Management
Jun 5, 2003
593
US
Am able to produce a comma-delimited logfile using the following:
'Keep track of Report Printing
Open "\\Serv-s01\Customer Service\CSDBLog.txt" For Append As #1
Print #1, CurrentUser() & ", " & Environ("Computername") & ", " & Date & ", " & Time & ", " & Me.Name
Close #1

On the OnOpen event of a Report.

However, no matter what I try, I cannot differentiate between Previewing the report and actually Printing it.

Any suggestions?

Let them hate - so long as they fear... Lucius Accius
 
Hello:

Under your command button for previewing a report, put the following:

Dim stDocName As String
stDocName = "YourReportName"
DoCmd.OpenReport stDocName, acPreview

For printing a report put the following under a command button:

Dim stDocName As String
stDocName = "YourReportName"
DoCmd.OpenReport stDocName, acNormal

Regards
Mark
 
I think I get where you're going with this - adding the logging code to each - with either "View" or "Print" at the end.

I can send the report directly to the printer when the Print cmdbtn is clicked, but is there a way to prevent printing once Preview mode is brought up or perhaps to bring up the report in a customized preview view which doesnt allow printing?

Let them hate - so long as they fear... Lucius Accius
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top