G
Guest
After exporting forms (and the connected queries, tables, and reports) to a
new db, the command button on the form does not work. It gives me the error
"OpenReport action was canceled".
Is there another change I need to make somewhere to make these forms work as
they did in the old db?
Here is the code for the command button:
Private Sub Command4_Click()
Dim stDocName As String
Dim accobj As AccessObject
On Error GoTo Err_Command4_Click
stDocName = "rpt_KeyMeasures_test"
'This function closes the report if the report is open and then re-opens
the report.
Set accobj = Application.CurrentProject.AllReports.Item(stDocName)
If accobj.IsLoaded Then
If accobj.CurrentView = acCurViewPreview Then
DoCmd.Close acReport, stDocName
DoCmd.OpenReport stDocName, acPreview
End If
Else
DoCmd.OpenReport stDocName, acPreview
End If
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub
new db, the command button on the form does not work. It gives me the error
"OpenReport action was canceled".
Is there another change I need to make somewhere to make these forms work as
they did in the old db?
Here is the code for the command button:
Private Sub Command4_Click()
Dim stDocName As String
Dim accobj As AccessObject
On Error GoTo Err_Command4_Click
stDocName = "rpt_KeyMeasures_test"
'This function closes the report if the report is open and then re-opens
the report.
Set accobj = Application.CurrentProject.AllReports.Item(stDocName)
If accobj.IsLoaded Then
If accobj.CurrentView = acCurViewPreview Then
DoCmd.Close acReport, stDocName
DoCmd.OpenReport stDocName, acPreview
End If
Else
DoCmd.OpenReport stDocName, acPreview
End If
Exit_Command4_Click:
Exit Sub
Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click
End Sub