Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Setting validation rule in VBA

    I swear, Access is gonna do me in soon...

    I set up few fields as required, Validation rule to Is Not Null and created a message - at the table design level. I also created a form with "OK" button that is set to requery another form...

    Guess what? If I leave those required fields blank, the validation rule and message doesn't fire. When I switch to the next form, the new addition doesn't show up because the validation rule had failed. I just discovered that if I close the form using all methods except using the close button, it works perfectly. However, if I use close button, the validation rules get completely ignored. How do I force the form to run validation rules before closing the form using the "close" button?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting validation rule in VBA

    Hi Brent, I would recommend using the form for validation rather than at the table-level. You can use the BeforeUpdate event to fire off the code that checks for validation.

    HTH <img src=/S/salute.gif border=0 alt=salute width=15 height=20>

  3. #3
    2 Star Lounger
    Join Date
    Feb 2001
    Location
    Seattle, Washington, USA
    Posts
    179
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Setting validation rule in VBA

    Thanks! It did the trick.

    Brent

Posting Permissions

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