One field dependent on another

dogs4kids

New member
Local time
Today, 14:03
Joined
Mar 12, 2009
Messages
5
In a form, I have a combo box from which the user can select either Phone or Email. I also have an Email text box on the form. How can I make the Email text box field required only when Email is selected in the combo box?

Thanks for the help.
 
If the combo returns the TEXT of "Email" when selected, you can use this in the Combo's AFTER UPDATE event:
Code:
Me.YourEmailTextBoxNameHere.Visible = (Me.YourComboBoxNameHere = "Email")
 
Or I guess you can unlock it.

As for "Required" you would need to validate it in the form's BEFORE UPDATE event something like:

Code:
If Me.YourComboBoxNameHere = "Email" And Len(Me.YourEmailTextBoxNameHere & "")=0 Then
   MsgBox "You must fill in an Email address if you have selected Email", vbExclamation, "Error"
   Cancel = True
End If
 

Users who are viewing this thread

Back
Top Bottom