Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-access > #9198

Re: Need to cancel the update to a bound form if edits fail (Access 2010)

From "Phil" <phil@stantonfamily.co.uk>
Newsgroups comp.databases.ms-access
Subject Re: Need to cancel the update to a bound form if edits fail (Access 2010)
Date 2014-03-26 20:12 +0000
Organization Aioe.org NNTP Server
Message-ID <lgvcas$eqa$1@speranza.aioe.org> (permalink)
References (1 earlier) <a93fbd13-a8a3-4612-9622-b75839f67856@googlegroups.com> <nkm0j9tk5imolfeo8t0stsmg9h9b751t78@4ax.com> <bpb9dmFg61jU1@mid.individual.net> <lgqdev$3f8$1@speranza.aioe.org> <bpdqeaF25ijU1@mid.individual.net>

Show all headers | View raw


On 25/03/2014 16:50:18, "Access Developer" wrote:
> "Phil" <phil@stantonfamily.co.uk> wrote > This is a routine to check a
> post code has been entered
> 
> > Private Sub Form_BeforeUpdate(Cancel As Integer)
> >
> >    If CheckPostCode = False Then
> >        DoCmd.CancelEvent
> >    End If
> >
> > End Sub
> 
> You did not set the Cancel argument... try this instead.
> 
> > Private Sub Form_BeforeUpdate(Cancel As Integer)
> >
> >    If CheckPostCode = False Then
> 
> Cancel = True            'This cancels the _Update_
> 
> >    End If
> >
> > End Sub
> 
> They provide the Cancel argument for a reason.  Read Help on the Cancel
> argument, and on DoCmd.CancelEvent. I do not remember that they are
> equivalent and that executing "DoCmd.CancelEvent" is a _replacement_ for
> setting "Cancel = True".
> 
> --
> Larry Linson
> Microsoft Office Access MVP
> Co-Author, Microsoft Access Small Business Solutions, Wiley 2010
> 
> 
> 


The office help file seems to imply that DoCmd.CancelEvent & Cancel = True
are equivalent

"All events that can be canceled in Visual Basic have a Cancel argument. You
can use this argument instead of the CancelEvent method to cancel the event.
The KeyPress event and MouseDown event (for right-clicking only) can be
canceled only in macros, not event procedures, so you must use the
CancelEvent action in a macro to cancel these events."

Interesting that they can’t spell cancelled correctly

I occasionally use “Cancel = True”, for no real reason, but use
DoCmd.CancelEvent in about 99% of cases. Somehow it psychologically it seems
a positive instruction rather than setting some airy fairy integer called
“Cancel” to true or False.

Phil

---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com

Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Need to cancel the update to a bound form if edits fail (Access 2010) PW <emailaddyinsig@ifIremember.com> - 2014-03-22 15:30 -0600
  Re: Need to cancel the update to a bound form if edits fail (Access 2010) Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-03-24 07:53 -0700
    Re: Need to cancel the update to a bound form if edits fail (Access 2010) PW <emailaddyinsig@ifIremember.com> - 2014-03-24 10:22 -0600
      Re: Need to cancel the update to a bound form if edits fail (Access 2010) "Access Developer" <accdevel@gmail.com> - 2014-03-24 12:47 -0500
        Re: Need to cancel the update to a bound form if edits fail (Access 2010) "Phil" <phil@stantonfamily.co.uk> - 2014-03-24 23:00 +0000
          Re: Need to cancel the update to a bound form if edits fail (Access 2010) Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-03-25 04:31 +0100
            Re: Need to cancel the update to a bound form if edits fail (Access 2010) "Phil" <phil@stantonfamily.co.uk> - 2014-03-25 09:42 +0000
            Re: Need to cancel the update to a bound form if edits fail (Access 2010) PW <emailaddyinsig@ifIremember.com> - 2014-04-03 21:21 -0600
          Re: Need to cancel the update to a bound form if edits fail (Access 2010) "Access Developer" <accdevel@gmail.com> - 2014-03-25 11:50 -0500
            Re: Need to cancel the update to a bound form if edits fail (Access 2010) Ulrich Möller <knobbi38@usenet.arcornews.de> - 2014-03-25 20:23 +0100
              Re: Need to cancel the update to a bound form if edits fail (Access 2010) "Access Developer" <accdevel@gmail.com> - 2014-03-26 14:46 -0500
            Re: Need to cancel the update to a bound form if edits fail (Access 2010) "Phil" <phil@stantonfamily.co.uk> - 2014-03-26 20:12 +0000
    Re: Need to cancel the update to a bound form if edits fail (Access 2010) PW <emailaddyinsig@ifIremember.com> - 2014-03-24 10:57 -0600
      Re: Need to cancel the update to a bound form if edits fail (Access 2010) Patrick Finucane <patrickfinucanetx@gmail.com> - 2014-03-24 10:21 -0700

csiph-web