Et
asked on
Defining a report format for each report for all printers
Hi! I'd like to format each of my reports automatically so the user won't have to change the paper orientation and size every time ('cause sometimes someone changes the paper format and orientation and the next user who wishes to print it must go change it back...
Any idea?
Thanx!
Et
Any idea?
Thanx!
Et
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
When using the print devmode, it will be unavailable if you compile your program into an mde.
But as pointed out above, the print devemode is the only solution for altering printer settings in access.
But as pointed out above, the print devemode is the only solution for altering printer settings in access.
ASKER
Great! It worked very well but I have 3 sligths changes to propose, for whoever needs to use those functions. First of all, because the PageSetup function opens the report in design mode, it looks better if you put the following lines before and after to hide that process :
doCmd.Echo False
........
DoCmd.Echo True
Second, still in the PageSetup function, I removed the lines regarding the PaperTray to be sure it is set to DeafultTray (I didn't find the appropriate constant in Access help). I needed to do tyhis because we have more than 20 printers (laser and inkjet) and some have legal paper in low tray, other in upper tray, etc... I configured the tray manually in every report instead.
Finally, I added a parameter (integer) to the OpenReport function so the user can choose to send to the printer immediately or to print preview it. So, instead of only these lines that open the report :
'if the report is cancelled because of no data, an error results in the OpenReport method
On Error GoTo ReportError
With DoCmd
.OpenReport ReportName, acPreview, , WhereClause
.RunCommand acCmdFitToWindow
.Maximize
End With
I now have this :
'if the report is cancelled because of no data, an error results in the OpenReport method
On Error GoTo ReportError
If ViewMode = acPreview Then
With DoCmd
.OpenReport ReportName, acPreview, , WhereClause
.RunCommand acCmdFitToWindow
.Maximize
End With
Else
DoCmd.OpenReport ReportName, acNormal, , WhereClause
End If
So I thank you bclark and the only thing that is very bad is the non availability using a mde, as said by SE...
doCmd.Echo False
........
DoCmd.Echo True
Second, still in the PageSetup function, I removed the lines regarding the PaperTray to be sure it is set to DeafultTray (I didn't find the appropriate constant in Access help). I needed to do tyhis because we have more than 20 printers (laser and inkjet) and some have legal paper in low tray, other in upper tray, etc... I configured the tray manually in every report instead.
Finally, I added a parameter (integer) to the OpenReport function so the user can choose to send to the printer immediately or to print preview it. So, instead of only these lines that open the report :
'if the report is cancelled because of no data, an error results in the OpenReport method
On Error GoTo ReportError
With DoCmd
.OpenReport ReportName, acPreview, , WhereClause
.RunCommand acCmdFitToWindow
.Maximize
End With
I now have this :
'if the report is cancelled because of no data, an error results in the OpenReport method
On Error GoTo ReportError
If ViewMode = acPreview Then
With DoCmd
.OpenReport ReportName, acPreview, , WhereClause
.RunCommand acCmdFitToWindow
.Maximize
End With
Else
DoCmd.OpenReport ReportName, acNormal, , WhereClause
End If
So I thank you bclark and the only thing that is very bad is the non availability using a mde, as said by SE...
You can set the page-settings using "File/Page Settings", but these will be lost when changing a printer...
Check this link for how to solve this from VBA:
http://www.mvps.org/access/reports/rpt0009.htm
(BTW there's a lot of access info/samples out there!)
Nic;o)