Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.databases.ms-access > #9197
| 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-26 14:46 -0500 |
| Message-ID | <bpgp54FlhpcU1@mid.individual.net> (permalink) |
| References | (2 earlier) <nkm0j9tk5imolfeo8t0stsmg9h9b751t78@4ax.com> <bpb9dmFg61jU1@mid.individual.net> <lgqdev$3f8$1@speranza.aioe.org> <bpdqeaF25ijU1@mid.individual.net> <lgsl34$7jp$1@dont-email.me> |
I agree. I avoid macros in code, though it's sometimes either necessary or useful. I know, from experience, that the Cancel = True approach works. Either one, of course, must be used in the appropriate event. -- Larry Linson Microsoft Office Access MVP Co-Author, Microsoft Access Small Business Solutions, Wiley 2010 "Ulrich Möller" <knobbi38@usenet.arcornews.de> wrote in message news:lgsl34$7jp$1@dont-email.me... > Am 25.03.2014 17:50, schrieb Access Developer: >> "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 >> >> > > You can use the macro as a replacement for setting the cancel argument to > true. This is equivalent at least in the form_beforeupdate event and > documented in the online help. The effect is the same. There are some > differences in the KeyPress and MouseDown events as described in the help > file. > > Nevertheless i prefer to not mix up vba programming and macros if there > are no special reasons for that and would always use the cancel argument > in this place. > > > Ulrich >
Back to comp.databases.ms-access | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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