[AccessD] How to evaluate if report was cancelled due to no data

Charlotte Foust cfoust at infostatsystems.com
Thu Aug 14 16:14:02 CDT 2003


Then the wierdness is coming from somewhere else.  Decompile and
recompile your code, check your references, and do all the other stuff
for gremlins.  Your form may actually have some corruption in it.

Charlotte Foust

-----Original Message-----
From: Susan Geller [mailto:sgeller at cce.umn.edu] 
Sent: Thursday, August 14, 2003 12:13 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] How to evaluate if report was cancelled due to no
data


Yes, I did and yes it is 2501.

-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com] 
Sent: Thursday, August 14, 2003 12:51 PM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] How to evaluate if report was cancelled due to no
data


Well, it will stop there even if the error isn't 2501.  Have you tried
printing out the value of Err.Number in the immediate window to be sure
that *is* the error you're handling?

Charlotte Foust

-----Original Message-----
From: Susan Geller [mailto:sgeller at cce.umn.edu] 
Sent: Thursday, August 14, 2003 9:44 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] How to evaluate if report was cancelled due to no
data


Yes, I have a breakpoint on the line If Err.Number = 2051 and the code
does stop there.  When I hit F8, the next line the code goes to is Else.
I put a breakpoint at the routine for CallStep3Settings but it doesn't
even go there.

--Susan


-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com] 
Sent: Thursday, August 14, 2003 11:26 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] How to evaluate if report was cancelled due to no
data


Are you saying that even though an error 2501 is returned, the error
handler doesn't drop into that part of the routine?  That doesn't make
any sense.  Did you put a breakpoint into the error handler to make sure
the Step3Settings wasn't returning an error?

Charlotte Foust

-----Original Message-----
From: Susan Geller [mailto:sgeller at cce.umn.edu] 
Sent: Thursday, August 14, 2003 8:17 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] How to evaluate if report was cancelled due to no
data


Charlotte,

Here's the code that I have (abbreviated) in the event that opens the
report.  When I step through, the Err.Number is in fact 2501, but the
code goes to the Else part of my If logic.  Ideas?

Private Sub cmdNext3_Click()
On Error GoTo eh

	strReport = Me.lstGroupOptions.Column(6)
	DoCmd.OpenReport strReport, acViewPreview

ex:
    Exit Sub              
eh:
    If Err.Number = 2501 Then
        Call Step3Settings
        GoTo ex
    Else
        MsgBox Err.Description
        GoTo ex
    End If
End Sub



-----Original Message-----
From: Charlotte Foust [mailto:cfoust at infostatsystems.com] 
Sent: Thursday, August 14, 2003 10:54 AM
To: Access Developers discussion and problem solving
Subject: RE: [AccessD] How to evaluate if report was cancelled due to no
data


You can trap an error 2501, which is what will be returned to the
calling routine but that will only tell you it has been cancelled, not
why.  You could raise a custom event from the report and sink it in the
calling form.  That would let the report tell you why it was cancelled.

Charlotte Foust

-----Original Message-----
From: Susan Geller [mailto:sgeller at cce.umn.edu] 
Sent: Thursday, August 14, 2003 7:35 AM
To: accessd at databaseadvisors.com
Subject: [AccessD] How to evaluate if report was cancelled due to no
data


XP.  I have a form that opens a report.  In the report, I have:

Private Sub Report_NoData(Cancel As Integer)
MsgBox "There are no data to display for the criteria you selected.",
vbOKOnly, "DataMart" Cancel = True End Sub

All's well. 

PROBLEM:  The report cancels, and it goes back to the line right after
the open report line of code.  At that point, I want to evaluate to see
if the report was cancelled so that I can do one thing if it was
cancelled due to no data and do something else if it wasn't.  How can I
do this?

--Susan


Susan B. Geller
Office of Information Systems
College of Continuing Education
University of Minnesota
306 Wesbrook Hall
77 Pleasant Street SE
Minneapolis, MN 55455
Phone:  612-626-4785
Fax:  612-625-2568


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list