Heenan, Lambert
Lambert.Heenan at aiuholdings.com
Wed May 6 10:57:23 CDT 2009
Carolyn, I had a similar problem when running the code under Access 2002 and XP SP2. I cannot remember how I arrived at the solution, I know I stepped though the code line by line and somehow came up with this. Just prior to calling the OutPutTo method I turn off Echo (so nothing visible happens to the screen) then I show the database window (invisibly!) and output the snapshot file. After that I hide the database window and turn echo back on. It seems that making the database 'visible' makes a difference. I have no clue why this works, but it did cure the problem of reports not being generated. Here is the modified code I use in the function ConvertReportToPDF ... ' Export the selected Report to SnapShot format DoCmd.Echo False 'Show the db window DoCmd.SelectObject acTable, , True DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _ strPathandFileName DoCmd.SelectObject acTable, , True DoCmd.RunCommand acCmdWindowHide 'turn the echo back on DoCmd.Echo True Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Carolyn Johnson Sent: Wednesday, May 06, 2009 11:37 AM To: Access Developers discussion and problem solving Subject: [AccessD] Lebans PDF code in Vista I have 2 databases (AS database, OS database) that use Lebans convert-to-pdf code. The code has worked great for years in Access2000-2003 and WinXP. When I run the AS database in Access2003 on my Vista computer, the code works fine. When I run the OS database in Access2003 on Vista, it stops at the Docmd.OutputTo acOutputReport, rptName, "SnapshotFormat(*.snp)", strPathandFileName line. The "outputting to . . " window pops up and goes away. The .snp file is not created. There's no error. It just stops running. There are differences between these 2 databases, but the code called -- convert to pdf -- is the same in both. If I import the code from the AS database to the OS database, the code no longer works. I've tried with an older version of Lebans code and the most recent version -- no differerence. I've tried decompiling the database -- no difference. Compiles fine. No missing references. Office2003 has the most recent updates on both the XP and Vista computers. (The code does run in XP.) Has anyone had this problem? Any ideas? Thanks Carolyn Johnson St Louis, MO -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com