Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Validating Entry (Acess 97)

    I have a tabbed form, on the last page are several option groups. I only need to ensure that 4 of these questions on the survey are answered before the form is closed. Do I check the record or the frame that holds the option group or the individual buttons in the option group? I am not sure how to write the If Then statement to check on these 4 items. Or what event to put it to once it is written. The finish button opens up a form which asks if the user is done, yes closes the file, no cancels the close event and keeps the tabbed form(survey) open.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Validating Entry (Acess 97)

    You need code in the form's BeforeUpdate event, something like this:
    <pre>If isnull(opt1)=true then
    msgbox "Hey, you didn't fill-in option #1!",vbexclamation
    Cancel=true
    exit sub
    endif
    </pre>

    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Validating Entry (Acess 97)

    I tried that piece of code, but the form closed anyway. I guess I have two questions now. Where you have "(opt 1)" does that refer to the Frame/Option Group object on the form or the option buttons themselves , or should it refer to the dB field where the value is stored? Second when does the update event fire, is it before the form closes? Will a cancel event there keep the current form open?

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Validating Entry (Acess 97)

    If the form is dirty, the BeforeUpdate event fires before the form actually closes. If you cancel the BeforeUpdate, you will get a message that you can continue to close the form, but that current changes will be lost.

    And I was referring to the group, not any individual option within the group.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    Lounger
    Join Date
    Jan 2001
    Location
    Pennsylvania, USA
    Posts
    36
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Validating Entry (Acess 97)

    If the form is NOT dirty (i.e. no data on the form was changed) the BeforeUpdate property of the form will not be triggered. However, you may want to put the same code in the OnClose or OnExit events for the form or the OnExit event for the page (tab).

Posting Permissions

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