• Setting validation rule in VBA

    Author
    Topic
    #356526

    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?

    Viewing 0 reply threads
    Author
    Replies
    • #527863

      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 salute

    Viewing 0 reply threads
    Reply To: Setting validation rule in VBA

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: