[AccessD] how to have access ignore a form that is canceled

Jim Dettman jimdettman at verizon.net
Wed Jul 29 07:15:19 CDT 2015


Bill,

  We've got a disconnect somewhere

  Certainly when you cancel a form open, error 2501 is returned to the
calling routine.  The code as you posted should be putting up your message
box.

  If your getting an actual break in execution then something odd is at work
since you've already said your error handling setting in VBA is correct.
If you are getting an actual break with the code you posted, then I would do
a /decompile as something's gotten out of whack.

Jim. 

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Bill Benson
Sent: Monday, July 27, 2015 09:38 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] how to have access ignore a form that is canceled

As I wrote before I get put into break mode with that error reported even
though I had on Error Resume next so I don't see what trapping error code
2501 will do for me. I will try again tomorrow
On Jul 27, 2015 8:09 PM, "Jim Dettman" <jimdettman at verizon.net> wrote:

>
>  Yes and maybe I didn't understand, but trapping 2501 is the norm...
>
> Jim.
>
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> Heenan, Lambert
> Sent: Monday, July 27, 2015 05:37 PM
> To: 'Access Developers discussion and problem solving'
> Subject: Re: [AccessD] how to have access ignore a form that is canceled
>
> Can't you just trap error 2501 - "OpenForm action was cancelled" ?
>
> Lambert
>
>
>
> -----Original Message-----
> From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
> Bill Benson
> Sent: Monday, July 27, 2015 5:08 PM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] how to have access ignore a form that is canceled
>
> Yes, that setting is there.
>
> The problem as I see it, is that Access doesn't like me to cancel a load
of
> a form when there was a calling routine that opened it. My feeling is, so
> what? Thats the idea. There ought to be a way to trap for that and
> disregard
> I have forbidden the form to open by design!
>
> On Mon, Jul 27, 2015 at 4:24 PM, Jim Dettman <jimdettman at verizon.net>
> wrote:
>
> > Bill,
> >
> >   With the VBA editor window open, click on tools/options.  Click the
> > general tab.
> >
> >   Make sure your selected to break on unhandled errors.
> >
> > Jim.
> >
> > -----Original Message-----
> > From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf
> > Of Bill Benson
> > Sent: Monday, July 27, 2015 03:38 PM
> > To: Access Developers discussion and problem solving
> > Subject: [AccessD] how to have access ignore a form that is canceled
> >
> > I am running this
> >
> > DoCmd.OpenForm "frmComments", acNormal, , , acFormEdit, , CStr(Me.ID)
> >
> > When the openargs is null, I cancel form load.
> >
> > How can I get Access to ignore that the form wont open instead of
> > throwing me into break mode?
> >
> >
> >
> > My error trapping is not working, and the problem arised before
> > Form_Error in the calling form so I cannot continue past it (which
> > makes sense since it is not a data error I guess).
> >
> > Private Sub cmdAddComment_Click()
> > On Error Resume Next
> > DoCmd.OpenForm "frmComments", acNormal, , , acFormEdit, , CStr(Me.ID)
> > If Err.Number <> 0 Then
> >     MsgBox "Could not open the comments form"
> > End If
> > End Sub
> > --
> > 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