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

kbishop94

Board Regular
Joined
Dec 5, 2016
Messages
246
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 > [B]1[/B] 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
 

My Aswer Is This

Well-known Member
Joined
Jul 5, 2014
Messages
16,030
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:

Forum statistics

Threads
1,077,614
Messages
5,335,253
Members
399,009
Latest member
twcaddell

Some videos you may like

This Week's Hot Topics

Top