FIX: Error Message "Report Width Is Larger Than the Paper Width" When Showing Data Report in Landscape

Article translations Article translations
Article ID: 261193 - View products that this article applies to.
This article was previously published under Q261193
Expand all | Collapse all

On This Page

SYMPTOMS

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

CAUSE

This error occurs because the width of your report exceeds the maximum width specified by the default printer settings. The width of the report is determined by taking the sum of the RightMargin, LeftMargin, and ReportWidth properties.

When a report prints or displays, the default printer settings in the Printers Folders are used to determine the layout of the report. Because the Printer object in Visual Basic cannot modify the default printer settings, if your default printer orientation is set to Portrait of standard Letter paper and you design a report that extends beyond 8.5 inches wide, the preceding error occurs.

NOTE: The LeftMargin, RightMargin, and ReportWidth properties are denoted in twips, and 1440 twips equal 1 inch.

RESOLUTION

Microsoft Visual Studio 6.0 Service Pack 4 and later service packs include a new property called Orientation for Data Report. The value for this property is:
  • rptOrientDefault = 0
  • rptOrientPortrait = 1
  • rptOrientLandscape = 2
With this property, you are able to tell the Data Report not to use the orientation setting of the default printer in the Printers Folders. Following is the syntax for implementing the Orientation property:
DataReport1.Orientation = rptOrientLandscape
DataReport1.Show
				
When you use this new Orientation property in Visual Studio 6.0 Service Pack 4, you may encounter the error below:
Compiler Error
Method or Data member not found.
To fix this error, delete the values for DataMember and DataSource properties of the Data Report and reassign these two properties with the original values.

STATUS

Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the next service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:
194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed
To download the latest Visual Studio service pack, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx

MORE INFORMATION

Steps to Reproduce Behavior

  1. Locate the default printer settings in Printers Folders on Windows. Make sure that the page orientation is set to Portrait of standard Letter paper.
  2. Create a new Visual Basic Standard EXE project. Form1 is created by default.
  3. Add a Command button to Form1.
  4. Paste the following code into Form1's code window:
    Option Explicit
    
    Private Sub Command1_Click()
      DataReport1.Show
    End Sub
    					
  5. From the Project menu, select Add Data Environment. DataEnvironment1 is added by default.
  6. In DataEnvironment1, right-click on Connection1 and choose Properties. Set the properties of Connection1 to be the following:
    • On the Provider tab, set Provider to Microsoft Jet 4.0 OLE DB Provider.
    • Click Next.
    • On the Connection tab, set the database name to NWIND.MDB, which should be in the folder where Visual Basic 6.0 is installed.
    • Click on Test Connection to make sure you are connected to the database, and then click OK.
  7. Right-click on Connection1 and choose Add Command. Command1 is added by default.
  8. Right-click on Command1 and select Properties. Set the properties of Command1 to be the following:
    • On the General tab, change the Database object to Table.
    • On the Object Name combo box, select Employees, and then click OK.
  9. From the Project menu, select Add Data Report. DataReport1 is added by default.
  10. Set the properties of DataReport1 to be the following:
    • Set the DataSource property to DataEnvironment1.
    • Set the DataMember property to Command1.
    • Set the ReportWidth property to 11520 (8 inches).
    • Set the LeftMargin property to 1440 (1 inch).
    • Set the RightMargin property to 1440 (1 inch).
  11. If you add ReportWidth, LeftMargin and RightMargin, you can see that the total report width is 10 inches, which is wider than 8.5 inches. So the Data Report should be placed on Landscape orientation of a standard Letter paper.
  12. Press the F5 key to run the program.
  13. Click on Command1, and note that the error message in the "Symptoms" section of this article occurs.

Steps to Fix the Problem in Visual Studio 6.0 Service Pack 4

  1. Open the preceding project in Visual Studio 6.0 Service Pack 4.
  2. Replace the code in Form1's code window with the following:
    Option Explicit
    
    Private Sub Command1_Click()
      DataReport1.Orientation = rptOrientLandscape
      DataReport1.Show
    End Sub
    					
  3. Delete the values for the DataMember and DataSource properties of DataReport1.
  4. Reassign the DataMember and DataSource properties of DataReport1 to be the following:
    • Set the DataSource property to DataEnvironment1.
    • Set the DataMember property to Command1.
  5. Press F5 to run the program.
  6. Click the Command1 button and note that DataReport1 is shown in Landscape orientation.

REFERENCES

This article fixes the problem addressed in the following article:
197915 PRB: Report Width is Larger than the Paper Width

Properties

Article ID: 261193 - Last Review: August 7, 2007 - Revision: 1.2
APPLIES TO
  • Microsoft Visual Basic 6.0 Professional Edition
  • Microsoft Visual Basic 6.0 Enterprise Edition
Keywords: 
kbbug kbdatabase kbfix kbvs600sp4fix kbvs600sp5fix KB261193

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com