DoCmd Save Generates 2501

J

Jim Satterfield

A little quirk of Access in both 97 and 2000 is that it easily loses track
of the printer settings. We had a problem with a report that prints in
landscape and uses legal paper resetting itself to letter size paper if the
user didn't load legal paper in time. Then it would keep that setting. So I
found some code that should programmatically set those characteristics every
time. It opens the report in design mode and assigns those values. But when
it runs DoCmd.Save it returns a 2501 error. The code is as follows:

If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode
DevString.RGB = strDevModeExtra
LSet DM = DevString
DM.lngFields = DM.lngFields Or DM.intOrientation 'Initialize fields.
DM.intPaperSize = 5 'Legal size
DM.intOrientation = 2 'Landscape
LSet DevString = DM 'Update property.
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
DoCmd.Save acReport, strName
DoCmd.Close acReport, strName
End If

Any ideas?
 

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

Similar Threads


Top