Having trouble with my code.
You can see the values of the list in the code.
Here's my code:
If cboGender.Text <> "Male" Or "Female" Then MsgBox "Please select from the list provided.", vbExclamation, "Error": cboGender.SetFocus: cboGender.Text = "Male": Exit Sub
If cboGender.Text = vbNullString Then MsgBox "Please select from the list provided.", vbExclamation, "Error": cboGender.SetFocus: cboGender.Text = "Male": Exit Sub
If cboStat.Text <> "Single" Or "Married" Or "Widow" Or "Seperated" Then MsgBox "Please select from the list provided.", vbExclamation, "Error": cboStat.SetFocus: cboStat.Text = "Single": Exit Sub
If cboStat.Text = vbNullString Then MsgBox "Please select from the list provided.", vbExclamation, "Error": cboStat.SetFocus: cboStat.Text = "Single": Exit Sub
The problem is that, even if i enter another value on my combobox except from the list provided, the error doesn't occur. It should only accept values from the list provided and doesn't accept any other values including null values.