DBServices
Programmer
I have a problem I can't figure out. I have a couple unbound combo boxes (cboEmployeeName and cboCustomerName) on an unbound form along with other controls as well. There are numerous controls on the form for user to select and once all are selected, I have a submit button that will run a SQL statement and Insert Into a table all the values. All works fine, but before I run the SQL statement I check to make sure all controls are selected and have values before sql statement runs. When I check to make sure the customer and employee have been selected in the combo boxes, it runs even if there is no selection.
My code is:
If Me.cboEmployeeName.Value = Null Then
MsgBox ("You must select an employee"), vbOKOnly, "NO EMPLOYEE SELECTED"
Me.Undo
Me.cboEmployeeName.SetFocus
Exit Sub
End If
I've tried using cboEmployeeName.value = false
and cboEmployeeName.value = ""
and that doesn't work either.
How can I make sure there is a selection in the combo box?
Any help is GREATLY appreciated!! Thanks, Dannie.
My code is:
If Me.cboEmployeeName.Value = Null Then
MsgBox ("You must select an employee"), vbOKOnly, "NO EMPLOYEE SELECTED"
Me.Undo
Me.cboEmployeeName.SetFocus
Exit Sub
End If
I've tried using cboEmployeeName.value = false
and cboEmployeeName.value = ""
and that doesn't work either.
How can I make sure there is a selection in the combo box?
Any help is GREATLY appreciated!! Thanks, Dannie.