{"id":53,"date":"2010-09-16T20:44:13","date_gmt":"2010-09-17T00:44:13","guid":{"rendered":"http:\/\/www.heliotropicsystems.com\/blog\/?p=53"},"modified":"2010-09-16T20:44:13","modified_gmt":"2010-09-17T00:44:13","slug":"access-2010-runtime-gotcha-with-report-to-pdf","status":"publish","type":"post","link":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/access-2010-runtime-gotcha-with-report-to-pdf\/","title":{"rendered":"Access 2010 Runtime Gotcha With Report to PDF"},"content":{"rendered":"<p>One of my small business client\u2019s is still using Microsoft Access 2000 for two of its databases.\u00a0 There never was any need, nor was there a desire, to upgrade the version of Access when the rest of the Office suite was upgraded.<\/p>\n<p>Now, Windows 7 is being rolled out across their office and they want to continue to contain costs.\u00a0 At my recommendation, they started using the <a href=\"http:\/\/www.microsoft.com\/downloads\/en\/details.aspx?FamilyID=57A350CD-5250-4DF6-BFD1-6CED700A6715\">Access 2010 Runtime<\/a>.\u00a0 This will permit their databases to continue to function without change \u2013 or without too much change.<\/p>\n<p>One thing that was discovered early during testing was that the Calendar control (MSCAL.OCX) is no longer supported in Access 2010.\u00a0 However, it is possible to continue to use the Calendar if you copy the file and register it.<\/p>\n<p>More importantly and just recently discovered was the errant output of one of their reports.\u00a0 The function uses Stephan Lebans\u2019 <a href=\"http:\/\/www.lebans.com\/reporttopdf.htm\">Report to PDF<\/a> code to take a report and convert it to PDF format.\u00a0 While this has worked for a very long time, with only a minor hitch or two as the DLLs changed, it has proven to be a valuable utility.<\/p>\n<p>Imagine the client\u2019s surprise when a recently created document was produced in A4 landscape format (11.69 x 8.27) \u2013 resulting in a loss of data on the report!\u00a0 Well, I was surprised and, at first, figured that some random printer setting was at fault.\u00a0 That wasn\u2019t it at all.<\/p>\n<p>Another aspect of Access 2010 that Microsoft changed was the elimination of the snapshot format for reports.\u00a0 Because this is the \u201cdriver\u201d for Lebans\u2019 code, the output defaulted to \u2013 I don\u2019t know what, but it didn\u2019t generate a valid report.<\/p>\n<p>On the plus side, Access 2010 allows you to create a report and send it directly to PDF.\u00a0 So, once it was clear that that some kind of coding change was necessary, it was relatively easy to implement.<\/p>\n<p>I simply had to test for the current version of Access, because the shop is still in transition. Those folks who haven\u2019t been upgraded continue to use the Lebans\u2019 code, while those who are using the Runtime, get to take advantage of the new functionality that Access 2010 provides.<\/p>\n<p>Here\u2019s a sample of the code:<\/p>\n<p>{code type=HTML}<\/p>\n<p>Dim blRet As Boolean<\/p>\n<p>&#8216;If greater than Access 2003, use the built-in PDF functionality<br \/>\nIf Int(Val(SysCmd(acSysCmdAccessVer))) &gt; 11 Then<br \/>\n     Dim acFormatPDF As Variant<br \/>\n     acFormatPDF = &#8220;PDF Format (*.pdf)&#8221;<\/p>\n<p>     DoCmd.OutputTo acOutputReport, strRptName, acFormatPDF, strPDFName<br \/>\n     blRet = True<br \/>\nElse<br \/>\n     &#8216; Call Stephen Lebans&#8217; convert function<br \/>\n     blRet = ConvertReportToPDF(strRptName, vbNullString, strPDFName, False, False)<br \/>\nEnd If<\/p>\n<p>{\/code}<\/p>\n<p>Now, everyone in the office can continue to produce PDF reports without any errors.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One of my small business client\u2019s is still using Microsoft Access 2000 for two of its databases.\u00a0 There never was any need, nor was there a desire, to upgrade the version of Access when the rest of the Office suite was upgraded. Now, Windows 7 is being rolled out across their office and they want <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/access-2010-runtime-gotcha-with-report-to-pdf\/\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[14,4],"tags":[15,16],"class_list":["post-53","post","type-post","status-publish","format-standard","hentry","category-microsoft-office-2010","category-small-business","tag-access-2010-runtime","tag-report-to-pdf"],"_links":{"self":[{"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/53","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=53"}],"version-history":[{"count":4,"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/53\/revisions"}],"predecessor-version":[{"id":57,"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/posts\/53\/revisions\/57"}],"wp:attachment":[{"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=53"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=53"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.heliotropicsystems.com\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=53"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}