section width error

G

Guest

Hello,

I am using VBA in an Access 2000 database to programmatically print reports
to the default printer. These two lines control the print:

DoCmd.OpenReport <ReportName>
DoCmd.PrintOut

The report prints out fine, however, an error message appears:

The section width is greater than the page width, and there are no items in
the additional space, so some pages may be blank. For example, the report
width may be wider than the page width.

Oddly, no pages do appear to be blank anywhere within the report, and no
controls/sections do appear to exceed (page width - margin widths). Still
stranger is that I can manually print this report and not get the error
message.

I have created several templates using the Report Wizard, tried reducing the
width of the report to like 3", tried landscape orientation, tried portrait
orientation, etc.

Can anyone tell me why this error message appears only when printing using
the above VBA code? Actually, what I really care about is just getting the
error message to not appear. I have an error-handling process (On Error GoTo
Errors...), which is not tripped when this error message occurs. So if there
is any way to just enter my error-handling process instead of automatically
displaying the error message, that's great too.

Thanks in advance for any insight anyone can provide.

Heather
 
D

David Lloyd

Heather:

One way to suppress the message is by using the DoCmd.SetWarnings function.
For example:

DoCmd.SetWarnings False
DoCmd.OpenReport <ReportName>
DoCmd.PrintOut
DoCmd.SetWarnings True

The following KB article relates to printing forms, but it deals with the
same issues as report printing, so I am including it as an additional
reference.

http://support.microsoft.com/default.aspx?scid=kb;en-us;314580

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.


Hello,

I am using VBA in an Access 2000 database to programmatically print reports
to the default printer. These two lines control the print:

DoCmd.OpenReport <ReportName>
DoCmd.PrintOut

The report prints out fine, however, an error message appears:

The section width is greater than the page width, and there are no items in
the additional space, so some pages may be blank. For example, the report
width may be wider than the page width.

Oddly, no pages do appear to be blank anywhere within the report, and no
controls/sections do appear to exceed (page width - margin widths). Still
stranger is that I can manually print this report and not get the error
message.

I have created several templates using the Report Wizard, tried reducing the
width of the report to like 3", tried landscape orientation, tried portrait
orientation, etc.

Can anyone tell me why this error message appears only when printing using
the above VBA code? Actually, what I really care about is just getting the
error message to not appear. I have an error-handling process (On Error
GoTo
Errors...), which is not tripped when this error message occurs. So if
there
is any way to just enter my error-handling process instead of automatically
displaying the error message, that's great too.

Thanks in advance for any insight anyone can provide.

Heather
 
G

Guest

Thank you! No more error message, and something to keep in my back pocket
for similar situations. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top