Re: What event to use for checking table values on a form when record is completed?
- From: John W. Vinson <jvinson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 03 Jan 2008 16:30:33 -0700
On Thu, 3 Jan 2008 10:36:59 -0800 (PST), raylopez99 <raylopez99@xxxxxxxxx>
wrote:
What event should I use to check values entered into a new record on a
form? The easiest one for me is "On Click" for a particular textbox,
but it requires user input. For the form itself, from "AfterUpdate",
On Current and "Before Update" are candidate--which one? Or are there
others?
Current fires the instant the user navigates to the record in question, before
they've made any changes. BeforeUpdate fires when the user has completed work
on a record and attempts to save it - e.g. closing the form, moving off the
record, moving to a subform, moving from a subform back to a mainform,
explicitly saving the record with Ctrl-Enter, etc. etc. It has a Cancel
parameter so if you're doing validation, it's the one to use.
AfterUpdate (as the name implies) fires after the record has successfully been
written to disk.
Also I plan to use this structure: (StockSymbol is a field in the
table bound to the form)
Is there a control on the form with StockSymbol as its control source - a
combo box perhaps? If so, it would be best to reference the control rather
than the fieldname.
If Me.NewRecord Then <--When will this condition trigger?
NewRecord won't "trigger". It's just True if the record being edited is the
new record, rather than the user editing some record which was previously
saved to the table.
ElseIf IsNull(Me.StockSymbol) Then
'STUFF TO CHECK HERE
Else
'OTHER STUFF
End If
Thanks!
RL
(BT--you're fired. And you won't get a favorable recommendation from
me for your next job).
<eeep!> Who's BT and what did he do!?
John W. Vinson [MVP]
.
- Follow-Ups:
- References:
- Prev by Date: Re: Confirm data change on close
- Next by Date: RE: Member Already Exists in an object module from which this obje
- Previous by thread: Re: What event to use for checking table values on a form when rec
- Next by thread: Re: What event to use for checking table values on a form when record is completed?
- Index(es):
Relevant Pages
|