Error after exporting forms to new db

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
Is it possible that you have code in report's On No Data report event that
cancels the report open event. Are you sure that there's something to
report?
-Ed
 
No. But just to try it out, I took out the On No Data report event and I
still get the same error.
 
Back
Top