Results 1 to 4 of 4

Thread: Validation (97)

  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validation (97)

    Validation
    My form fields and table fields have validation rules like:

    Is Not Null And Not ""

    And yet, when I run my form, enter a new record and just enter say one field, I am still able to close the form and save EMPTY values into table fields I specified as required.

    What state are these text fields in if I close the form without even touching them, obviously not NULL or

  2. #2
    2 Star Lounger
    Join Date
    Apr 2001
    Location
    Wellington, New Zealand
    Posts
    173
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Validation (97)

    Access won't actually check validation of form fields unless you actually go into that field and enter something into it.

    You have two options that I can think of:

    1. This is possibly the easiest. Apply your validation at table level. You can also use the field's 'Allow Zero Length" property to stop the "". If you still find that this doesn't work, you may need to use the IsNull() function rather than Is Null.

    2. Use the BeforeUpdate Event of the form to check the state of all the fields. I usually use a tag on the required fields, using code, cycling through all controls on the form, if the control has the appropriate tag, then I check to make sure that it isn't null or zero length. If it is, I cancel the update and send a message to the user, usually changing the background colour of the control to highlight it to the user.

    Hope this helps

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Validation (97)

    Hi Jayden,
    I

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Validation (97)

    What do you see if you try to add a record directly to the table? When I set something up like that, I see the Access message that the field cannot be a zero-length string, not the message I put into the validation text. However, I'm running Access 2000. Personally, I would put the validations in the form and forget trying to get the table's validation message to pop up.
    Charlotte

Posting Permissions

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