tags:

views:

67

answers:

2

I am having a problem when my program is installed to another computer, where its printer preference is different, where my data report accepts Letter size 8.2 * 11 in, because when the printer preference is different the data report well not show and gives an error saying the page width is larger than paper width, does anyone know how to fix this problem.

i tried this code but it didn't work

Printer.PaperSize = vbPRPSLetter

+1  A: 

Check out the Microsoft KnowledgeBase article FIX: Error Message "Report Width Is Larger Than the Paper Width" When Showing Data Report in Landscape

When using the Show method of Data Report to preview the report, the page orientation defaults to the default printer settings on the local computer. Therefore, if the orientation of the default printer settings is set to Portrait of standard Letter paper and your report width is more than 8.5 inches wide, the following error occurs: Report Width is Larger than the Paper Width.

The solution appears to be setting Orientation before using the Data Report. Change DataReport1 to the name of your data report.

DataReport1.Orientation = rptOrientLandscape
DataReport1.Show

EDIT Another suggestion: Microsoft offer a free DLL that allows you to change the default settings for the printer. You could try using that free DLL in your project, then do something like this code below before using the data report. Microsoft say "this DLL is particularly useful when dealing with the Data Report, which reads the default printer orientation prior to displaying or printing a report."

  Set obj = New PrinterControl
  obj.ChngOrientationLandscape
MarkJ
it gives me an error, saying Variable not defined when compile
Mahmoud
@Mahmoud Change `DataReport1` to the name of your data report.
MarkJ
@MarkJ, i know i changed it, but i how to add the dll to the software, cause i am trying to register it on my windows 7 but i keep getting an error, and when i follow microsoft method i keep getting an error, what do you suggest
Mahmoud
@Mahmoud about the "variable not defined": do you have Visual Basic 6 **service pack 6** installed? If not I suggest you install the service pack. About the error on registering the DLL. Are you logged on as administrator? Can you tell us the exact error message please?
MarkJ
@MarkJ i did update my visual basic 6 to service pack 6, and i still get error, about the error that show while registering the dll is `The Module c:/users/nobody/Desktop/pageset.dll was loaded but the call to dllregisterserver failed with error code 0x80004005`
Mahmoud
+1  A: 

-Can you just switch to a custom paper size?

Printer.PaperSize = 256
Printer.Width = 11808  '(8.2 * 1440)
Printer.Height = 15840 '(11 * 1440)

-Are you sure the error isn't related to the maximum print width of the report itself? Many printers have a max print width that forces 1/4" margins on either side of a paper. Which in your case forces your printable area to be 7.7" max. Quickest way to check would be to temporarily set the print wide to a lower value and see if it works.

-Another possibility could be permissions to the printer. If it's a shared network resource it may be locked down and be rejecting the changes to the paper settings and throwing an inaccurate error msg.

jasonk
Hey There, the report well only print when i change my printer preference to letter, then the datareport well open and i tried your method i keep gettting an error on `printer.papersize = 256`
Mahmoud