Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Kendrick, Idaho, USA
    Posts
    277
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Keep user in form (2000)

    The user must fill in one or both of two special fields (call them FieldA and FieldB) but may not leave them both blank. How can I keep the user from leaving this form until this condition is satisfied? I can trigger a cautioning message when they leave the form - but by that time, the form is closed. I need to trigger the message if they TRY to exit and before the form closes.

    Thanks

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

    Re: Keep user in form (2000)

    See the attached zipped database. A boolean variable is used to keep track of whether the form can be closed. (The demo actually does a bit more - it also forces the user to use a "Close" command button to close the form, not the x in the upper right corner of the form.) With the form open in design view, select View | Code to see the VBA code used.
    Attached Files Attached Files

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Kendrick, Idaho, USA
    Posts
    277
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: Keep user in form (2000)

    Yes! Thank you so much.

Posting Permissions

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