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.
10 6542
This should help you out, CD Tom: -
Dim strReport As String
-
Dim rpt As Report
-
-
strReport = "Employees"
-
'Open the Report in Preview/Hidden Mode
-
DoCmd.OpenReport strReport, View:=acViewPreview, WindowMode:=acHidden
-
-
'Retrieve the Paper Size set for the Report
-
With Reports(strReport)
-
With .Printer
-
''Check Values for the acPrintPaperSize Enumerated Constants in the Object Viewer
-
Select Case .PaperSize
-
Case acPRPSLetter
-
'Set the Paper Size for the Report strReport to 11 x 17 if it is Letter
-
Reports(strReport).Printer.PaperSize = acPRPS11x17
-
Case acPRPSLegal
-
MsgBox "Legal"
-
Case acPRPS11x17
-
MsgBox "11 x 17"
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
'Case ...
-
Case Else
-
MsgBox "Paper Size not Supported"
-
End Select
-
End With
-
-
'Close the Report strReport, and Save any changes
-
DoCmd.Close acReport, strReport, acSaveYes
-
End With
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.
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.
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.
If I see that the printer is set at A4...
- Dim strReport As String
-
Dim rpt As Report
-
-
strReport = "Employees"
-
-
'Open the Report in Preview/Hidden Mode
-
DoCmd.OpenReport strReport, View:=acViewPreview, WindowMode:=acHidden
-
-
'Retrieve the Paper Size set for the Report
-
With Reports(strReport)
-
With .Printer
-
If .PaperSize = acPRPSA4 Then
-
'Paper Size is A4, now what...
-
End If
-
End With
-
End With
-
-
'Close the Report strReport, and Save any changes
-
DoCmd.Close acReport, strReport, acSaveYes
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. - ' Check default printer for paper size
-
Const RptName As String = "Posse Report"
-
Const contwipsperInch As Long = 1440
-
With Application.Printer
-
If .PaperSize = acPRPSA4 Then ' if paper size A4 then change report paper size to A4 and change margins
-
DoCmd.OpenReport RptName, View:=acViewPreview, WindowMode:=acHidden
-
With Reports(RptName).Printer
-
.PaperSize = acPRPSA4
-
.LeftMargin = 0.15 * contwipsperInch
-
.RightMargin = 0.15 * contwipsperInch
-
End With
-
DoCmd.Close acReport, RptName, acSaveYes
-
End If
-
End With
-
DoCmd.OpenReport RptName, acPreview
-
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
@CD Tom: Try removing Code Line # 12 - DoCmd.Close acReport, RptName, acSaveYes
as in: - Const RptName As String = "Posse Report"
-
Const contwipsperInch As Long = 1440
-
-
With Application.Printer
-
If .PaperSize = acPRPSA4 Then
-
DoCmd.OpenReport RptName, View:=acViewPreview, WindowMode:=acHidden
-
With Reports(RptName).Printer
-
.PaperSize = acPRPSA4
-
.LeftMargin = 0.15 * contwipsperInch
-
.RightMargin = 0.15 * contwipsperInch
-
End With
-
End If
-
End With
-
-
DoCmd.OpenReport RptName, acPreview
When I remove Line 12 and run the compile I get Compiler error end with without With
@CD Tom: Remove Line# 12 and nothing else, exactly as I have posted in Post# 8.
That worked fine I read you post wrong sorry.
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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...
|
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...
|
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...
|
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
|
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...
|
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
|
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...
|
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,...
|
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...
|
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
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |