ODE97: OutputTo Action Was Canceled Error in Run-time AppID: Q173334
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you use the OutputTo method or RunCommand method in a Microsoft Access
97 run-time application, you may receive the following error message:
The OutputTo action was canceled.
-or-
The RunCommand action was canceled.
Your computer has only a run-time version of Microsoft Access 97 installed, and you are using an action or method that prompts the user for an input or output file name. For example, if you use the OutputTo method and leave the Outputfile argument blank, Microsoft Access prompts you for an output file name.
Explicitly supply the file name so that Microsoft Access does not have to
prompt the user for one. If you want to prompt the user for a file name,
you can use the ShowOpen or ShowSave methods of the Common Dialog ActiveX
control.
The following steps demonstrate how to use the Common Dialog ActiveX
control to prompt the user for an output file name and type, and then how
to supply it to the OutputTo method.
Private Sub Command0_Click()
Dim oCmnDlg As CommonDialog
Dim strFormat As String
Dim strFileName As String
Set oCmnDlg = Me!cmndlg.Object
On Error GoTo Export_Err
With oCmnDlg
' Clear the file name before prompting.
.FileName = ""
' Prompt the user if the file already exists.
.flags = cdlOFNOverwritePrompt + cdlOFNHideReadOnly
' Determine if the cancel button was pressed.
.CancelError = True
.Filter = _
"MS-DOS Text (*.txt)|*.txt|Rich Text Format (*.rtf)|*.rtf" _
& "|Microsoft Excel (*.xls)|*.xls"
.FilterIndex = 1
' Default the initial directory to "C:\My Documents".
.InitDir = "C:\My Documents"
.ShowSave
' Determine what file type was selected; then save the
' file in that format.
Select Case .FilterIndex
Case 1 ' MS-DOS Text Format.
strFormat = acFormatTXT
Case 2 ' Rich Text Format.
strFormat = acFormatRTF
Case 3 ' Microsoft Excel Format.
strFormat = acFormatXLS
End Select
strFileName = .FileName
End With
DoCmd.OutputTo acOutputTable, "Customers", _
strFormat, strFileName
Exit Sub
Export_Exit:
Exit Sub
Export_Err:
' Check to see if the cancel button was pressed.
If Err.Number = 32755 Then
Resume Export_Exit
Else
MsgBox Err.Number & ", " & Err.Description
End If
Resume Export_Exit
End Sub
Using the following arguments of the RunCommand method result in a prompt
for an input or output file name:
acCmdCreateReplica
acCmdEncryptDecryptDatabase
acCmdImport
acCmdLinkTables
Sub Command0_Click()
DoCmd.OutputTo acOutputTable, "Customers", acFormatTXT
End Sub
For more information about the OutputTo method, search the Help Index for
"OutputTo method," or ask the Microsoft Access 97 Office Assistant.
For more information about the RunCommand method, search the Help Index for
"RunCommand method," or ask the Microsoft Access 97 Office Assistant.
For more information about the Common Dialog ActiveX control, search the
Help Index for "CommonDialog control," or ask the Microsoft Access 97
Office Assistant.
Additional query words: prb ode
Keywords : OtpProb OtpGnrl
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Last Reviewed: July 9, 1999