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


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

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

From "Access Developer" <accdevel@gmail.com>
Newsgroups comp.databases.ms-access
Subject Re: Need to cancel the update to a bound form if edits fail (Access 2010)
Date 2014-03-25 11:50 -0500
Message-ID <bpdqeaF25ijU1@mid.individual.net> (permalink)
References <atvri9t1mnupssoccgf1g81d8mqbm67utk@4ax.com> <a93fbd13-a8a3-4612-9622-b75839f67856@googlegroups.com> <nkm0j9tk5imolfeo8t0stsmg9h9b751t78@4ax.com> <bpb9dmFg61jU1@mid.individual.net> <lgqdev$3f8$1@speranza.aioe.org>

Show all headers | View raw


"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
 

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