Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: VBA for checking to see if fields in a form are not empty when 'close form' button is executed

  1. #11
    Board Regular
    Join Date
    Dec 2016
    Location
    Houston, TX
    Posts
    179
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA for checking to see if fields in a form are not empty when 'close form' button is executed

    Quote Originally Posted by My Aswer Is This View Post
    My script only included Textboxes.

    I thought you said my script worked perfectly but you wanted two textboxes exclude.
    I asked what were the names of the Textboxes you wanted excluded and you said:

    txtIncidentID
    DTPicker1

    Well

    DTPicker1

    Is not a Textbox.

    My bad. I appoligize. Regardless, your code is working fine. I just changed this part from:

    Code:
    If x > 0 Then
    to this:

    Code:
    If x > 1 Then
    And that seems to cancel out the 2 controls that autopopulate when the form is opened and doesnt trigger the yes/no prompt in your code when the close button is clicked. Perfect! THanks again, My Aswer Is This

  2. #12
    Board Regular My Aswer Is This's Avatar
    Join Date
    Jul 2014
    Posts
    14,084
    Post Thanks / Like
    Mentioned
    19 Post(s)
    Tagged
    6 Thread(s)

    Default Re: VBA for checking to see if fields in a form are not empty when 'close form' button is executed

    Well if that works for you great.
    I think you will find if one of the other Textboxs have a value in them other then the one you wanted excluded you will not get a warning message.

    So for example if the textbox you wanted excluded is empty but TextBox4 has a value in it the script will not give you a warning.
    If that proves true you will have to get back with me.
    Last edited by My Aswer Is This; Oct 3rd, 2018 at 03:02 PM.
    Be sure and always test this script on sample data the first time you use this as to avoid any problems with your data. Always trying to learn more and help others where I can. I'm using Excel 2013.
    Patience please Iím not perfect yet. "Memories are forever"

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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