Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1529

Command button validation before emailing and disabling command button once clicked

$
0
0
I am not entirely sure that I am even posting this in the correct place. I am very new to VBA, so forgive my ignorance.

I am creating forms for employees to submit because they can't be trusted to just send emails and keep the appropriate formatting.
I have the forms completed in Word 2013 and the command buttons are sending the emails.

Now I just need help with two more things, both pertaining to the command button.

1) I am getting forms submitted that do not have any information filled in. I know that I need to validate the data upon click. All I am really wanting is for none of the fields to be left blank, so I know that the validation needs to say "if FieldA OR FieldB OR FieldC are blank, then stop the process, else continue process".
I just can't figure out the appropriate code to use or appropriate place within VB to put it.
I would also be perfectly happy with "if FieldA OR FieldB OR FieldC are blank, then button not visible, else button visible"

And....

2) I am getting multiple duplicate forms submitted due to people double-clicking.
To eliminate that, I need to disable the submit button when clicked. I have tried using:

Code:

Private Sub CommandButton1_Click()
CommandButton1.Enabled = False

However, when the document is pulled up by the next person, the button is still disabled. How can I fix this?

Viewing all articles
Browse latest Browse all 1529

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>