Error after exporting forms to new db

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
 
E

Ed Robichaud

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
 
G

Guest

No. But just to try it out, I took out the On No Data report event and I
still get the same error.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top