Re: Validation Rule on Table Field vs Form Control



On Mar 7, 2:24 pm, "Larry Linson" <boun...@xxxxxxxxxxxxx> wrote:
Table validations are applied when you write the Record, and that's what
happens when you go from a main Form to the Form embedded in a Subform
Control. You can "protect yourself" with Table-level validation and _also_
protect your users from unfriendly error messages, by _also_ including
validation in VBA code in the AfterUpdate of Controls on the Form. (Yes, I
know -- extra work... frustrating, isn't it?)

Larry Linson
Microsoft Access MVP

"gweasel" <bane...@xxxxxxxxx> wrote in message

news:1173278530.215387.4170@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

I have set the Required property to yes and moved the validations to
the table level instead of the form level. I like to have the
validation rules in effect though because the error messages that come
up when only the Required property are set are not helpful to the end
user (they refer to the field name as "[Tbl_Name].[Field_Name]" and
that is confusing to the users.

I am actually having an issue though. I swear this was working
earlier in the week, but even before moving the rules to the table
level, when I went through to test the system, I am able to breeze
right through the supposedly required fields/controls. Now, if I am
switching from a form to the subform, I get the unhelpful "required
property" error message, but never see the validation text I typed
out. And ideally, I'd want this message to pop up when they are
trying to exit the required control on the form rather than when
they're trying to exit another control to get into a subform. For
example, "Due Date" is required, but it is 5 tab stops away from my
subform. They can tab/click right past "Due Date" and never know they
missed something that was required until 5 steps later. I think this
is adding to confusion as well - since they're most likely going to
look in the last field they were in to try and fix the problem, when
in reality, they need to go back farther than that.

Make sense? Any idea how I can have these messages pop up "On exit"
basically, without coding? If coding is needed, I guess that's fine,
but please give me some hint as to what I need to make it work and
give the user a custom message instead of the default messages Access
gives.

Thanks.

On Mar 7, 6:03 am, "Don Leverton" <leveriteNoJunkM...@xxxxxxxxxxxxxxx>
wrote:
Hi,

IMHO, it sounds like it would just be easier to set the "Required"
property
to "Yes" in the table design view in a case like this.

HTH,
Don

"gweasel" <bane...@xxxxxxxxx> wrote in message

news:1173238121.938426.306890@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

What is the best way to apply a Validation Rule - or rather, where is
the best place to put it? Is there an advantage to putting it on the
field in the table vs setting the validation rule on the form the
control is on?

Basically I have a number of controls in a form that are required, and
to check it I am setting the Validation Rule to "<>"IsNull" so that
when the user tries to tab through/click out of a required area
without entering anything, they are alerted. I noticed though, after
I'd set up a few controls on the form this way, that the same settings
are also available when creating the table that drives the form.

Just curious and want to fix possible problems before I release the
system to the end users.

Thanks.

It's not that much extra work - just one of those things I thought
(like so many others) would be included in the properties or regular
functions. But, alas, coding it is. Thanks for the advice and
explanations.

.



Relevant Pages

  • Re: Validation Rule on Table Field vs Form Control
    ... happens when you go from a main Form to the Form embedded in a Subform ... validation in VBA code in the AfterUpdate of Controls on the Form. ... they're trying to exit another control to get into a subform. ...
    (comp.databases.ms-access)
  • Re: Where do I put the code main or subform?
    ... I have a main form and a subform. ... used to display the record, say, student records, that ... control. ... validation that is too complex to use in a field's Validation Rule; ...
    (microsoft.public.access.formscoding)
  • Re: Suspend form close
    ... Thanks again for all of your help, and for the validation code you provided. ... Thank you too for your explanation of Cancel = True. ... >> from what I have seen, but the error messages aren't all that helpful. ... > You pass it the current form object and an array of control names. ...
    (microsoft.public.access.formscoding)
  • Re: Where do I put the code main or subform?
    ... Form_BeforeUpdate is the best solution for record-level validation that ... Allen Browne - Microsoft MVP. ... my forms (main and subform) are probably different. ... control. ...
    (microsoft.public.access.formscoding)
  • Re: Validation Controls
    ... It will show the error messages provided you either have a ValidationSummary ... > "Ben Lucas" escribió en el mensaje ... >> You can control whether a validator will execute through the Enabled ... You will also want to control when the validation happens, ...
    (microsoft.public.dotnet.framework.aspnet)