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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Report doesnt use the custom paper size

Status
Not open for further replies.

szarrehp

Programmer
Jun 5, 2008
2
US
I have created a custom paper size (11 X 4) for printing on preprinted delivery tickets (on a okidata 320/1 dot matrix printer). I created this in the server properties of the printers & faxes. The new paper size is called "TV".

Back to MS ACCESS 2002, in design mode, I went to "page setup" and forced the form/report to select the new paper size ("TV") and the specific printer (okidata 320/1). I also changed the margins, closed page setup and saved the report.

The .mde file that I created works fine on my system (sys1) but not on the other system (sys2)that I installed this on. I created the same custom paper size "TV" on sys2 and even the same printer drivers however the report defaults to letter size paper and skips a bunch of tickets. While the report is in preview mode we can go to page setup and change it to the correct paper size but it doesnt keep the settings and the same procedure has to be performed w/each print.

I would greatly appreciate any help on resolving this.
 
As of 2002, the printer object has been revamped, and one of its new features is the ability to set just about everything programmatically. I'm pretty sure you can code around this (I have done something similar that works well). I have yet to get the design view printer settings to "stick" (persist) between printings on any of our Acc 2K2 installations.
Have a look here:

"Time flies like an arrow; fruit flies like a banana."
 
thanks for you suggestion, it pointed me in the right direction. I have to say that it was quite bit of a pain figuring out how to use the custom paper size property. In the hopes of preventing anyone else from going thru it, I'm posting my code which btw WORKS:

Type Printer_DevMode
strDeviceName(1 To dmDeviceNameLen) As Byte
intSpecVersion As Integer
intDriverVersion As Integer
intSize As Integer
intDriverExtra As Integer
lngFields As Long
intOrientation As Integer
intPaperSize As Integer 'paper size ID (or 255 for custom)
intPaperLength As Integer
intPaperWidth As Integer
intScale As Integer
intCopies As Integer
intDefaultSource As Integer
intPrintQuality As Integer
intColor As Integer
intDuplex As Integer
intYResolution As Integer
intTTOption As Integer
intCollate As Integer
strFormName(1 To dmFormNameLen) As Byte
intLogPixels As Integer
lngBitsPerPixel As Long
lngPelsWidth As Long
lngPelsHeight As Long
lngDisplayFlags As Long
lngDisplayFrequency As Long
lngICMMethod As Long
lngICMIntent As Long
lngMediaType As Long
lngDitherType As Long
lngICCManufacturer As Long
lngICCModel As Long
bytDriverExtra(1 To dmExtraSize) As Byte
End Type



'----------
'Report_GetDevMode()
'get devmode and return a pointer to it
'Input: report name (rpt), pointer to devmode (dm)
'Output: None
'----------
Public Function Report_GetDevMode(ByVal rpt As String, ByRef dm As Printer_DevMode) As Boolean
Dim dmstr As Printer_DevModeStr 'type used in conversion

DoCmd.OpenReport rpt, acViewDesign
dmstr.strDevMode = Reports(rpt).PrtDevMode
LSet dm = dmstr
DoCmd.Close acReport, rpt
End Function



'----------
'Report_SetPaperSize()
'sets papersize of a report
'Input: string of report name (rpt), int for papersize (papersize), paper width and length (width, length)
'Output: None
'----------
Public Function Report_SetPaperSize(ByVal rpt As String, papersize As Integer, Optional paperwidth As Long = 0, _
Optional paperlength As Long = 0)
Dim dm As Printer_DevMode
Report_GetDevMode rpt, dm
If paperlength = 0 And paperwidth = 0 Then
dm.lngFields = (dm.lngFields Or adhcDMPapersize) And Not (adhcDMPaperLength Or adhcDMPaperWidth)
dm.intPaperSize = papersize
Else
dm.lngFields = dm.lngFields Or adhcDMPapersize Or adhcDMPaperLength Or adhcDMPaperWidth
dm.intPaperSize = papersize 'custom paper size-256
dm.intPaperWidth = paperwidth
dm.intPaperLength = paperlength
dm.intOrientation = 2 '1-portrait, 2-landscape

End If
Report_SetDevMode rpt, dm

End Function


Report_SetPaperSize("reportName", 256, 2794, 1016)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top