jennifercorp
New Member
- Joined
- Jun 25, 2012
- Messages
- 11
I have a form that on submit button click needs to check for required fields and then present a msgbox that states each fields that still requires information. I was able to figure out how to check for required fields and present the message box with the code below, but it displays each individual message boxes one after the other instead of all in one msgbox. In addition to narrowing down to one msgbox, I would like for the required fields to be conditional. Say,
if A1=Yes and B1=No then check for these required fields
Else
if A2=No and B2=Yes then check for these required fields
Else
check for these required fields.
I hope that I've explained this well and would sincerely appreciate any thoughts that anyone might have on the best direction to go on this. Also, this is in a button click event. Thanks in advance.
Code that I am using now....
If Range("C9").Value = "" Then
MsgBox "Date is a required field.", vbOKOnly, "Required Field"
End If
If Range("C10").Value = "" Then
MsgBox "Auditor is a required field.", vbOKOnly, "Required Field"
End If
Else
....
if A1=Yes and B1=No then check for these required fields
Else
if A2=No and B2=Yes then check for these required fields
Else
check for these required fields.
I hope that I've explained this well and would sincerely appreciate any thoughts that anyone might have on the best direction to go on this. Also, this is in a button click event. Thanks in advance.
Code that I am using now....
If Range("C9").Value = "" Then
MsgBox "Date is a required field.", vbOKOnly, "Required Field"
End If
If Range("C10").Value = "" Then
MsgBox "Auditor is a required field.", vbOKOnly, "Required Field"
End If
Else
....