Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2005

Tip: Looking for answers? Try searching our database.

OutputTo Snapshot Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Dan - 19 Aug 2005 22:31 GMT
I'm using the following code in an Access 2k database to save some reports to
MS Snapshot files:

strSQL = "SELECT * FROM CustRptSelectReports WHERE
CustRptSelectReports.Select = yes " _
           & "AND CustRptSelectReports.reportID = " & ReportID & ";"
       Set rst = dbs.OpenRecordset(strSQL)
       If rst.RecordCount > 0 Then
           DoCmd.OutputTo acOutputReport, "rptCustomerCover", acFormatSNP,
, False
           sSleep 1000
           rst.MoveFirst
           Do Until rst.EOF
               Select Case rst!Survey_Type
                   Case "Warewash"
                       DoCmd.OutputTo acOutputReport,
"rptCustomerWarewash", acFormatSNP, , False
                   Case "Laundry"
                       DoCmd.OutputTo acOutputReport, "rptCustomerLaundry",
acFormatSNP, , False
                   Case "Ancillary"
                       DoCmd.OutputTo acOutputReport,
"rptCustomerAncillary", acFormatSNP, , False
                   Case "Housekeeping"
                       DoCmd.OutputTo acOutputReport, "rptCustomerHK",
acFormatSNP, , False
                   Case "Floor Care"
                       DoCmd.OutputTo acOutputReport, "rptCustomerFC",
acFormatSNP, , False
               End Select
               sSleep 1000
               rst.MoveNext
           Loop
           sSleep 1000
           DoCmd.OutputTo acOutputReport, "rptCustomerSummaryMain",
acFormatSNP, , False
       Else
          MsgBox "Please select a survey(s)"
          Me.Visible = True
       End If
   End If
   rst.Close

The code works fine if I step through it one line at a time. The code also
works fine if I open the form from the database window. However, if I open
the program as the user would and choose the tool from the main menu, the
first report is saved but when the second report comes up I receive an error:
"The command or action 'OutputTo' isn't available now." I tried entering code
to pause the process to give the report time to be saved but no matter how
long of a pause was entered the same error occured. The same code structure
also works fine if I use the RTF format. Something is obviously happening
with the Snapshot format. Can anyone help? Thanks.
RuralGuy - 21 Aug 2005 15:05 GMT
>I'm using the following code in an Access 2k database to save some reports to
>MS Snapshot files:
[quoted text clipped - 48 lines]
>also works fine if I use the RTF format. Something is obviously happening
>with the Snapshot format. Can anyone help? Thanks.

How about sprinkling some DoEvents in your code and see what happens.
_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Dan - 22 Aug 2005 15:20 GMT
Adding DoEvents did not solve the problem. The error still occurs.

> >I'm using the following code in an Access 2k database to save some reports to
> >MS Snapshot files:
[quoted text clipped - 53 lines]
> hth - RuralGuy (RG for short)
> Please post to the NewsGroup so all may benefit.
Dan - 22 Aug 2005 16:57 GMT
The problem was caused by the database window being hidden. I wrote code to
unhide the window before outputting the reports and code to hide it again
after the process was finished. No more errors.

> I'm using the following code in an Access 2k database to save some reports to
> MS Snapshot files:
[quoted text clipped - 48 lines]
> also works fine if I use the RTF format. Something is obviously happening
> with the Snapshot format. Can anyone help? Thanks.
RuralGuy - 22 Aug 2005 22:42 GMT
Cool!  Thanks for posting back with your success.

>The problem was caused by the database window being hidden. I wrote code to
>unhide the window before outputting the reports and code to hide it again
>after the process was finished. No more errors.

_______________________________________________
hth - RuralGuy (RG for short)
Please post to the NewsGroup so all may benefit.
Peanut1 - 14 Sep 2005 20:56 GMT
try putting something in to close out any previous reports that may still be
open?

> I'm using the following code in an Access 2k database to save some reports to
> MS Snapshot files:
[quoted text clipped - 48 lines]
> also works fine if I use the RTF format. Something is obviously happening
> with the Snapshot format. Can anyone help? Thanks.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.