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!

Printing to custom paper size 1

Status
Not open for further replies.

AccessGuruCarl

Programmer
Jul 3, 2004
471
US
I have a report, that is basically like an address book.

The report width is 4.5 inches.
The paper size is 5.5 x 8.5

When I try printing, and set the custom paper size in the printer options, On Print... It prints to 8.5 x 11 so page 1 is being partially printed on page 2, and page 2 gets moved to the 3 peice of paper, and so on....

Is there a way to define the paper size in Access. Page Setup is not working for Custom Paper, it reverts to back 8.5 x 11

Help........

Thanks,

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
As far as I recall, you need to set the report to use a specific printer, if you want the custom paper to stick. I think that the paper size is a property of the printer.
 
Carl
If you are using Access 2000, here is a method that will work.

Tom
----------
Setting Page Size in Access 2000

Put the following code in a Module. Call the Function either from the form which drives the report, or call it in an AutoExec macro at the time of database startup.
----------------------------------------
Code:
Option Compare Database
Option Explicit

Type str_DEVMODE
   RGB As String * 94
End Type

Type type_DEVMODE
   strDeviceName As String * 16
   intSpecVersion As Integer
   intDriverVersion As Integer
   intSize As Integer
   intDriverExtra As Integer
   lngFields As Long
   intOrientation As Integer
   intPaperSize As Integer
   intPaperLength As Integer
   intPaperWidth As Integer
   intScale As Integer
   intCopies As Integer
   intDefaultSource As Integer
   intPrintQuality As Integer
   intColor As Integer
   intDuplex As Integer
   intResolution As Integer
   intTTOption As Integer
   intCollate As Integer
   strFormName As String * 16
   lngPad As Long
   lngBits As Long
   lngPW As Long
   lngPH As Long
   lngDFI As Long
   lngDFr As Long
End Type

Public Function SetEnvelope(strName As String)
   Dim rpt As Report
   Dim strDevModeExtra As String
   Dim DevString As str_DEVMODE
   Dim DM As type_DEVMODE

   On Error GoTo SetEnvelope_Error

DoCmd.Echo False
DoCmd.OpenReport strName, acDesign 'Opens report in Design view.

Set rpt = Reports(strName)

If Not IsNull(rpt.PrtDevMode) Then
   strDevModeExtra = rpt.PrtDevMode
   DevString.RGB = strDevModeExtra
   LSet DM = DevString
   DM.lngFields = DM.lngFields Or DM.intOrientation 'Initialize fields.
   DM.intPaperSize = 20 '#10 Envelope size
   DM.intOrientation = 2 'Landscape
   LSet DevString = DM 'Update property.
   Mid(strDevModeExtra, 1, 94) = DevString.RGB
   rpt.PrtDevMode = strDevModeExtra
   DoCmd.Save acReport, strName
   DoCmd.Close acReport, strName
   
DoCmd.Echo True
End If

Set rpt = Nothing

   On Error GoTo 0
   Exit Function

SetEnvelope_Error:

    MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure SetEnvelope of Module ModuleForSetting#10Envelopes"

End Function


NOTE the two lines
DM.intPaperSize = 20 '#10 Envelope size
DM.intOrientation = 2 'Landscape
The values here can be changed as desired. For DMintOrientation, the value for Portrait mode is 1, the value for Landscape mode is 2.

The following chart gives the various values for paper size…

Page size Value
10 x 14 in. 16
11 x 17 in. 17
A3 8
A4 9
A4 small 10
A5 11
B4 12
B5 13
C size sheet (17 x 22 in.) 24
D size sheet (22 x 34 in.) 25
Envelope #10 20
Envelope #11 21
Envelope #12 22
Envelope #14 23
Envelope #9 19
Envelope B4 33
Envelope B5 34
Envelope B6 35
Envelope C3 29
Envelope C4 30
Envelope C5 28
Envelope C6 31
Envelope C65 32
Envelope DL 27
Envelope (110 x 230 mm.) 36
Envelope Monarch 37
6-3/4 Envelope 38
E size sheet 26
Executive 7
German Legal fanfold 41
German std. fanfold 40
US std. fanfold 39
Folio 14
Ledger 4
Legal 5
Letter 1
Letter small 2
Note (8.5 x 11 in.) 18
Quarto 15
Statement 6
Tabloid 3
User-defined 256

* These values come from Access Cookbook by Getz, Litwin and Baron.
 
Thanks for the post's...

Remou - Yes this worked the 1st time around, but it didn't on the 2nd and 3rd attempt, unless I reset the printer again. My problem here is that I hide Access's background and only display the forms. They can only click a preview button or the print button.

THWatson - Yes I'm using Access 2000, I tried using the page size of 39, std US Fan fold but I didn't work. I guess thats not the correct paper size for an 8.5 x 11 cut in half! I'll try a few others and also try swithing to landscape...

Any other idea's
Thanks Again....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
I also have an alternative.

Print this on 8.5 x 11 with 2 columns...

Isn't this possible by making this report into a label like report? I've did this once before, but do not recall what I did create the label report. And when I view the old report I don't see anything special I did!

Thanks Again...

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Carl
According to my book, US std Fanfold is 14.875" X 11"

I am wondering about trying a setting of 256, which is a custom size.

Tom
 
THWatson,

Tried the 256 setting, yes it remembered it was custom paper, but the printers default custom size 850x1100 which is 8.5x11! And it reverted to printing to an 11" length.

The reports are run only by one user, so I've reset Access's background when she needs to run it. And advised her she needs to set this size before printing!

So this problem is resolved. Thanks for input.

I was asked a new issue, I'll bounce it off you before posting.

I'm looking to grab the 1st record (C_Name) and the last record (C_Name) for each page, and print them in the page header for each page. Similiar to a phonebook....
I'll grab the first 3 characters of each name.

Heres an example.
Page 1
Abu - Ala
Page 2
Alb - All

Thanks Again....

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Carl
One of the difficulties with placing this in the Page Header is that Access doesn't know the total page until it formats it...meaning that it's easier to do what you ask in the Page Footer.

I have the solution to that in a book at home, but I won't be home for some time.

Here is something that might send you in a positive direction...
1. In the Page Header, put a text box. Call it txtFirstItem, and make it invisible. (change that to grab only the first 3 letters, by using Left if you wish)
2. In the Page Footer, put a text box. Set its Control Source to =[txtFirstItem] & " -- " & [YourField]
3. Set the OnFormat event property for the Page Header to the following...
Code:
Private Sub PageHeader0_Format(Cancel As Integer, FormatCount As Integer)
     txtFirstItem = [YourField]
End Sub

See if this works. If not, perhaps you should make a new post.

Regards.

Tom
 
Hi Tom,

Yes that worked...
But, If you have a sample or solution for the header method I'd rather implement that.

Thanks for all the help!

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Here's a STAR THWatson...

The link was perfect... Exactly what I was looking for!

Thanks Again...

AccessGuruCarl
Programmers helping programmers
you can't find a better site.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top