Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validation issue (A2K, W2kPro)

    I have implemented validation on an access project and it all works fine, except in the case where a user accidentally enters data into the field. when the user goes back and deletes the data, the validation gets triggered. As a work-around, we use a dummy value that satisfies the validation genie but that's not an ideal solution. My feeling about this is that the validation is triggered when the form field is in "dirty" mode -- since data was once entered it expects data again. Not really sure tho.

    However, on browsing the lounge there appears to be some consensus on using BeforeUpdate on the form to do validation routines in VBA, which makes more sense to me overall. Any general concepts on validation as a subject and best practices? My bias is, as a web developer, to do web-like validation, meaning, validate the form. Access forms don't behave like a remote web page so this bias doesn't seem sensible but I'd still like to do something in terms of saving/not saving a entire form of data rather than as-one-types which is an Access perogrative. I understand the advantages of doing it the Access way and Can Deal - but, to keep from going on and on, a simple question:

    is there a way to keep a form-field validation from triggering when the user deletes erroneous input? Or is this something that should be addressed in BeforeUpdate on the form?

    TIA

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Validation issue (A2K, W2kPro)

    If you have a validation rule such as <code><50</code>
    , it will fire if the user clears the field. To get round this, you can use <code><50 Or Is Null</code>. This will allow the user to remove an existing value.

    Some validation is best done at the field level, for example if you want to prevent the user to enter values over 50, you can use Validation or the Before Update event of the text box. You don't want the user to be able to leave a value of 67 in the text box.

    Other validation is best done at the form level, in the Before Update event of the form, for example if you want to check that a text box has been filled in, or if you have a complex condition that depends on the values of several controls.

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    austin, Texas, USA
    Posts
    1,029
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Validation issue (A2K, W2kPro)

    thanks Hans! I tried the is null before but put it before Instr test. putting it after does, in fact, solve the problem.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •