View Single Post
 
Old 05-05-2016, 01:56 PM
derajlance derajlance is offline Windows 10 Office 2013
Novice
 
Join Date: May 2016
Posts: 18
derajlance is on a distinguished road
Default Disable email function of command button if all form fields are not completed

Now that I have my forms completed and emails sending the way I need them to send, I want to tweak a few things.

Is there any way to disable the email function of a command button if all form fields are not completed? If not, is there a way to prevent moving to the next field until the one before it is filled out?

I have figured out how to display an error upon exiting the form field with the following code:

Code:
Sub ExitText1()
    With ActiveDocument.FormFields("Text1")
        If Len(.Result) < 1 Then
            Application.OnTime When:=Now + TimeValue("00:00:001"), Name:="GoBacktoText1"
            MsgBox "This is a required field."
        End If
    End With
End Sub

But this does not prevent the user from submitting the form and sending the email.

Thanks in advance!
Reply With Quote