473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Best way to handle A4 and letter paper size

489 256MB
I have some users that use standard letter paper 8 1/2 X 11 but I do have some that use the A4 paper size. Is there a way to recognize what paper the user is using and switch. What's the best way to handle reports. When user switches to A4 paper some of the reports will show up on a second page because A4 paper is narrower.
Does anybody have a good answer to this problem?
Thanks for all your help.
Sep 16 '11 #1
10 6542
ADezii
8,834 Expert 8TB
This should help you out, CD Tom:
Expand|Select|Wrap|Line Numbers
  1. Dim strReport As String
  2. Dim rpt As Report
  3.  
  4. strReport = "Employees"
  5. 'Open the Report in Preview/Hidden Mode
  6. DoCmd.OpenReport strReport, View:=acViewPreview, WindowMode:=acHidden
  7.  
  8. 'Retrieve the Paper Size set for the Report
  9. With Reports(strReport)
  10.   With .Printer
  11.     ''Check Values for the acPrintPaperSize Enumerated Constants in the Object Viewer
  12.     Select Case .PaperSize
  13.       Case acPRPSLetter
  14.         'Set the Paper Size for the Report strReport to 11 x 17 if it is Letter
  15.         Reports(strReport).Printer.PaperSize = acPRPS11x17
  16.       Case acPRPSLegal
  17.         MsgBox "Legal"
  18.       Case acPRPS11x17
  19.         MsgBox "11 x 17"
  20.       'Case ...
  21.       'Case ...
  22.       'Case ...
  23.       'Case ...
  24.       'Case ...
  25.       'Case ...
  26.       'Case ...
  27.       'Case ...
  28.       'Case ...
  29.       'Case ...
  30.       'Case ...
  31.       'Case ...
  32.       Case Else
  33.         MsgBox "Paper Size not Supported"
  34.     End Select
  35.   End With
  36.  
  37.   'Close the Report strReport, and Save any changes
  38.   DoCmd.Close acReport, strReport, acSaveYes
  39. End With
Sep 16 '11 #2
CD Tom
489 256MB
That is one of the things I was looking for. The other is in the report design the report takes up 8 inches of the paper with .25 left margin and .25 right margin. When I switch to A4 paper which is narrower the report prints on two pages instead of one. Should I make two reports one for the A4 and only use 7 1/2 inches of the paper for the report body? Then if the user is using the A4 paper print that report instead.
Thanks again for your help.
Sep 16 '11 #3
Rabbit
12,516 Expert Mod 8TB
That's really up to you isn't it? What I would do is just create the 7.5 inch version of the report. And if I wanted to center the report, I would set the margin to .5 or .25 depending on the size of the paper they're using.
Sep 16 '11 #4
CD Tom
489 256MB
Is there a way to look at the users printer and see what paper size the default printer is set at? If I see that the printer is set at A4 then I could make the appropriate adjustment to the reports.
Thanks again for all your help.
Sep 16 '11 #5
ADezii
8,834 Expert 8TB
If I see that the printer is set at A4...
Expand|Select|Wrap|Line Numbers
  1. Dim strReport As String
  2. Dim rpt As Report
  3.  
  4. strReport = "Employees"
  5.  
  6. 'Open the Report in Preview/Hidden Mode
  7. DoCmd.OpenReport strReport, View:=acViewPreview, WindowMode:=acHidden
  8.  
  9. 'Retrieve the Paper Size set for the Report
  10. With Reports(strReport)
  11.   With .Printer
  12.     If .PaperSize = acPRPSA4 Then
  13.       'Paper Size is A4, now what...
  14.     End If
  15.   End With
  16. End With
  17.  
  18. 'Close the Report strReport, and Save any changes
  19. DoCmd.Close acReport, strReport, acSaveYes
Sep 17 '11 #6
CD Tom
489 256MB
I did a search and found your article "Printer and Printing Tips" using that I have check the default printer for the paper size and if paper size is A4 I want to change the paper size in the report from letter to A4 the following code is what I'm using but when I look at the report after changes are supposed be made but nothing has changed.
Expand|Select|Wrap|Line Numbers
  1.      ' Check default printer for paper size
  2.     Const RptName As String = "Posse Report"
  3.     Const contwipsperInch As Long = 1440
  4.     With Application.Printer
  5.         If .PaperSize = acPRPSA4 Then ' if paper size A4 then change report paper size to A4 and change margins
  6.             DoCmd.OpenReport RptName, View:=acViewPreview, WindowMode:=acHidden
  7.             With Reports(RptName).Printer
  8.                 .PaperSize = acPRPSA4
  9.                 .LeftMargin = 0.15 * contwipsperInch
  10.                 .RightMargin = 0.15 * contwipsperInch
  11.             End With
  12.             DoCmd.Close acReport, RptName, acSaveYes
  13.         End If
  14.     End With
  15.     DoCmd.OpenReport RptName, acPreview
  16.  
I've compiled the code with no errors, when I pause the code and step through it everything seems to be working.
Can you see what's wrong with my code.
Thanks
Sep 17 '11 #7
ADezii
8,834 Expert 8TB
@CD Tom: Try removing Code Line# 12
Expand|Select|Wrap|Line Numbers
  1. DoCmd.Close acReport, RptName, acSaveYes 
as in:
Expand|Select|Wrap|Line Numbers
  1. Const RptName As String = "Posse Report"
  2. Const contwipsperInch As Long = 1440
  3.  
  4. With Application.Printer
  5.   If .PaperSize = acPRPSA4 Then
  6.     DoCmd.OpenReport RptName, View:=acViewPreview, WindowMode:=acHidden
  7.       With Reports(RptName).Printer
  8.         .PaperSize = acPRPSA4
  9.         .LeftMargin = 0.15 * contwipsperInch
  10.         .RightMargin = 0.15 * contwipsperInch
  11.       End With
  12.   End If
  13. End With
  14.  
  15. DoCmd.OpenReport RptName, acPreview
Sep 17 '11 #8
CD Tom
489 256MB
When I remove Line 12 and run the compile I get Compiler error end with without With
Sep 17 '11 #9
ADezii
8,834 Expert 8TB
@CD Tom: Remove Line# 12 and nothing else, exactly as I have posted in Post# 8.
Sep 17 '11 #10
CD Tom
489 256MB
That worked fine I read you post wrong sorry.
Sep 17 '11 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Todd | last post by:
I have a mix of reports that are designed to print on either legal or letter size paper. When a legal sized report is first viewed in Print Preview, Page Setup uses the default Window printer's...
5
by: Ira S | last post by:
I use a DYMO labelwriter with my Access 97 database. I just purchased a new computer and in the report section under page setup/paper size, the new computer keeps changing the size automatically. I...
5
by: bcanavan | last post by:
When I export xml(and xls) from Access 2003 the result is a complete report in a single page. I would like to get the entire report in a single page (one trip to the server) for printing and...
0
by: Anniech | last post by:
I use VB.NET to integrate with crystal report 9.0 to print a report with custom paper size (using Dot Matrix printer). I have already added a custom paper size in the printer server and set the...
2
by: JohnHorb | last post by:
I have a Crystal Report which is set to A4 paper size, both at design time, and also in run-time code. However, when displayed in the web viewer, it is cut off at 'letter' size. Any ideas? John
3
by: D Witherspoon | last post by:
No matter what I do the default paper size is always either A3 or 11 by 8.5 .. Here is the code. Dim dlg As DialogResult pd.DocumentName = "Weld Image" Dim pkPaperSize As New...
13
by: matt | last post by:
hello, im guessing the answer is "no", but can a webpage set the printer's paper size & layout? trying to spare my intranet users some extra steps. thanks, matt
6
by: Brewtzaff | last post by:
Hello, I have a little problem to print my reports on custom sized paper. I got a db containing clubmembers, a query which selects only the needed infos to print out my membershipcards. My...
3
by: brianflannery | last post by:
Greetings all! My problem is this. I've installed a new printer on my computer. This is the "default printer" for access. Now, some of my reports, which were working fine with the old printer,...
3
by: CD Tom | last post by:
I have a report that can fix on letter size paper of on legal size depending on the number of columns that is printed on the report. I would like to change the paper size in the program depending on...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.