[AccessD] On-site emergency! A2K: Error when clicking cancel in report dialog

Mike and Doris Manning mikedorism at ntelos.net
Fri Aug 15 14:02:51 CDT 2003


You need to check to see if frmDateRange is still open before proceeding
with the Report_Open Code.

Public Function IsOpen(strName As String, Optional intObjectType As Integer
= acForm) As Boolean
    ' Returns True if strName is open, False otherwise.
    ' Assume the caller wants to know about a form.
    ' MsAccess example
    IsOpen = (SysCmd(acSysCmdGetObjectState, intObjectType, strName) <> 0)
End Function

Doris Manning
Database Administrator
Hargrove Inc.
www.hargroveinc.com


-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Christopher
Hawkins
Sent: Friday, August 15, 2003 2:51 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] On-site emergency! A2K: Error when clicking cancel in
report dialog


I'm on-site with one of my few remaining clients right now.  I can't afford
to foul this up.

I have a form (frmReport) that presents a list of reports to the user.

Some reports require date ranges, so in the Open event of the report, I have
code (stolen straight) from Northwind that will open the date range dialog
(frmDateRange) modally.  Ordinarily, the user would enter a date range and
click OK, rendering frmDateRange invisible and allowing the rest of the
Report_Open code to fire.

But if the user clicks Cancel in frmDateRange, the code in Report_Open is
supposed to see that frmDateRange is no longer loaded, set Cancel = True,
and close.  And it does - but Access also throws a 2501 error that breaks on
the DoCmd.Open Report line from frmReport!

I've tried trapping for error 2501 in frmReport - the procedure doesn't even
make it to the error handling section of the sub; it just sits there on the
DoCmd.OpenReport line.  I don't know what to do to either avoid throwing
thid error (preferable), or managing what happens after the error is thrown.

And before you ask, I cannot paste code because my client won't let me.

Heeeeeeeelp...

-Christopher-

_______________________________________________
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