Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1022
  • Last Modified:

docmd.printout - page range data type limitation?

ms access 2007

i have a report that is 42000 pages long.  i am trying to use vba to print out specific ranges of pages (spreading print job across multiple printers).

when i try to print a range with a starting or ending page number over 32768, i get an error stating data type error with one of my arguments.   it is happening with this line:

docmd.printout acPages, pageLow, pageHigh

both pageLow and pageHigh are declared as Long, i've also tried Variant.

i also tried:
docmd.printout acPrintAll

but, that only prints out 32767 and stops (without error)


if there is a limitation with the data type in the command, is there a workaround?

if i do it manually with the print window (ctrl-p), it has no problems doing it.

what am i missing?

thank you.
0
deputycollector
Asked:
deputycollector
  • 7
  • 4
  • 3
  • +1
3 Solutions
 
Jim P.Commented:
I suspect that it is the same issue as mine with linking tables -- http://www.experts-exchange.com/Q_23797557.html. M$ built the Access never expecting someone to come up with a document that has more pages than an integer (32767) and have never gone back and fixed it.

I really can't think of a good solution to this.

Maybe report it at http://connect.microsoft.com or http://office.microsoft.com and they'll fix it in an SP depending on version.
0
 
Jeffrey CoachmanMIS LiasonCommented:
Jim,
(Off Topic)
In your referenced link, your post was the "Accepted" solution, yet you were awarded 0 Points?
0
 
Jeffrey CoachmanMIS LiasonCommented:
deputycollector,

What manner of report is this?

Can you try breaking it up into seperate reports (or filtering it)?

For example, if this report is "All Collections" you could possibly break it down by State, Or Date Range, or Type of Collection.
Then print each individually.

JeffCoachman
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
GRayLCommented:
While PageLow and PageHigh are both declared Long, is there something else in the report that is Integer, increments by 1 per page, and sucks after 32767? ;-)
0
 
deputycollectorAuthor Commented:
boag2000 - unfortunately, the nature of the job doesnt break up that easily.  it would be a last resort and something i have have considered, but, is not desirable given the

grayl - there is nothing that increments per page that is programmatic in nature.  the only incrementing item would be [Page], but, that seems to work fine over 32767.  however, the [Pages] value does not...it actually goes negative (overflow?) with pages higher than 32767.

the irritating thing is that the documentation calls out the data types as Variant and therefore i would have assumed i would be ok.

jimpen - i'll try and report it.

hopefully, someone else might have a magical fix/tweak???

i am thinking i might have to resort to some sort of SendKeys sequence to use the real print dialog, but, i am "learning" my way thru that one as we speak.
0
 
Jeffrey CoachmanMIS LiasonCommented:
...And simply calling up the Print Dialog box is not an option?

Dim strRptName As String

strRptName = "YourReport"
   
    'Turn off the screen
    DoCmd.Echo False
    'Open the report
    DoCmd.OpenReport strRptName, acViewPreview
    'Open the Print Dialog box
    DoCmd.RunCommand acCmdPrint
    'Close the report
    DoCmd.Close acReport, strRptName
    'Turn the screen back on
    DoCmd.Echo True

End Sub

You could get crazy and try SendKeys, but I would not trust it with dialog boxes.

Going further even further out, you could try converting the Report to a PDF file , then try to automate the printing Via some Adobe hook.
http://www.adobe.com/devnet/acrobat/pdfs/iac_api_reference.pdf


JeffCoachman


0
 
GRayLCommented:
There's the problem.  For some dumb reason, In Access 2003, Page is a Long variable whereas Pages is Integer and of course limited to 32767.  It looks like  they did't fix it in Access 2007.
0
 
Jim P.Commented:
>> In your referenced link, your post was the "Accepted"
>> solution, yet you were awarded 0 Points?

Jeff,

I was also the asker of the Q. I was awarding points just for other experts taking a look.
0
 
GRayLCommented:
Type Alt+F11 to get to the VBA Editor window and type 'Page' in the Help window.  Look at both the Page Property and the Pages collection.  In A2003 Page is Long and Pages is Integer.  Confirm that Access 2007 types both as Variant?
0
 
Jeffrey CoachmanMIS LiasonCommented:
Jim,
   
<I was also the asker of the Q. I was awarding points just for other experts taking a look.>

OIC

;-)

Jeff
0
 
Jim P.Commented:
Have you considered dumping it to something like PDFCreator and then printing from the PDF?
0
 
deputycollectorAuthor Commented:
grayl - access 2007 does identify the Pages parameter as an Integer (read/write).  however, the Docmd.Printout page indicates the data types of the start and ending pages should be Variant...making one think it is ok to try a Long range.

jimpen - ironically, this ordeal started with an attempt to print the entire thing to pdf. when using the PrinOut method, regardless of the destination, stops at 32767.  the pdf printer is the printer i need to get it working to, but, the problem appears to be at a lower level (since it doesnt work to any printer type).

boag - calling up the print dialog is fine, but, since i dont want user intervention, i need the SendKeys (or similar) technique to work, and i had (and have) been struggling to get that to behave properly for some reason.

i have resorted to the split the print job into multiple jobs.   takes much longer, but, it gets me to my destination.

basically, i print the job to multiple pdfs, then i have another process (perl) that uses "pdftk" to break it up into individual pages, that then get named using the sort key from the original print job.  end result gets the pages individually searchable/retrievable by another web based search program.

pain in the arse, but, i will get it to work with this less than desirable approach.

i appreciate all the feedback.
0
 
Jeffrey CoachmanMIS LiasonCommented:
Thanks,

But you could have really split the points.

The other experts here also contributed very useful information.
Please click the "Request Attention" button to split the points.

;-)

Jeff
0
 
deputycollectorAuthor Commented:
ok.  thank you for the suggestion.  and, sorry for the confusion.
0
 
Jeffrey CoachmanMIS LiasonCommented:
Yes,
For example, I did not know of the Datatypes involved with these values.
This info, pointed out by the other experts, is useful info, and should be noted.

;-)
0
 
Jeffrey CoachmanMIS LiasonCommented:
I'm feelin' the Love!
;-)
0
 
Jim P.Commented:
Glad to be of assistance. May all your days get brighter and brighter.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 4
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now