ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,738
- Office Version
- 2007
- Platform
- Windows
Evening,
I have a working code that checks text boxes before the form is submitted.
Also on the form are 3 CheckBoxes & 3 OptionButtons
Below is the working code which works fine for the TextBoxes but now i need to allow for 3 CheckBox & 3 OptionButton
Please can you advise.
I have a working code that checks text boxes before the form is submitted.
Also on the form are 3 CheckBoxes & 3 OptionButtons
Below is the working code which works fine for the TextBoxes but now i need to allow for 3 CheckBox & 3 OptionButton
Please can you advise.
Code:
Private Sub CommandButton1_Click()
Cancel = 0
If TextBox2.Text = "" Then
Cancel = 1
MsgBox "Customer not entered"
TextBox2.SetFocus
ElseIf TextBox3.Text = "" Then
Cancel = 1
MsgBox "Item Not Entered"
TextBox3.SetFocus
ElseIf TextBox4.Text = "" Then
Cancel = 1
MsgBox "Tracking Not Entered"
TextBox4.SetFocus
ElseIf TextBox5.Text = "" Then
Cancel = 1
MsgBox "Username Not Selected"
TextBox5.SetFocus
ElseIf CheckBox1.Value = "" Then
Cancel = 1
MsgBox "Username Not Selected"
TextBox5.SetFocus
End If
If Cancel = 1 Then
MsgBox "not all values have been entered"
Exit Sub
End If