Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OpenReport action was canceled.

Status
Not open for further replies.

paukste

IS-IT--Management
Nov 27, 2003
10
0
0
LT
I use TreeView as a menu to open forms, reports. I'm stuck in the opening reports which use a dialog form to enter date before.
Problem : On click to open report a dialog form opens to enter date for report, but when I close dialog form without entering data to open report I get error "OpenReport action was canceled. " My actions don't reach error handling. After line "bInReportOpenEvent = False" get error. Can you suggest something how to solve it.

Private Sub tvw_NodeClick(ByVal Node As MSComctlLib.Node)
On Error GoTo Err_tvw_NodeClick

DoCmd.OpenReport "Profit", acViewPreview

Exit_tvw_NodeClick:
Exit Sub
Err_tvw_NodeClick:
Resume Exit_tvw_NodeClick
End sub

I tried to write error trapping something like this, but nothing helped, I get the same error before reaching error handler:

Private Sub Report_Open(Cancel As Integer)
On Error GoTo ErrHandler
bInReportOpenEvent = True
DoCmd.OpenForm "dateinterval", , , , , acDialog
If IsLoaded("dateinterval") = False Then Cancel = True
bInReportOpenEvent = False
Egress:
Exit Sub

ErrHandler:
Select Case Err.Number
Case 2501

Case Else
MsgBox "goog"
End Select
Resume Egress
End Sub

Public bInReportOpenEvent As Boolean
Function IsLoaded(ByVal strFormName As String) As Boolean
Dim oAccessObject As AccessObject
Set oAccessObject = CurrentProject.AllForms(strFormName)
If oAccessObject.IsLoaded Then
If oAccessObject.CurrentView <> acCurViewDesign Then
IsLoaded = True
End If
End If
End Function
 
In fact I get error while opening report with date enter on the dialog form.
"the expression is typed in incorrectly, or it's too complex to be evaluated....."
Maybe somebody knows where the problem is?
 
I've checked. The last posted problem is with an expression in the report's query. But if I try to open another report and cancel dialog form without entering data I receive error "OpenReport action was canceled." marked line DoCmd.OpenReport "Profit", acViewPreview
 
Thank you. I've solved problem. It was problem in VBA options -> error trapping. I've changed from "break on all errors" to "unhandled errors" and my error disappeared.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top