I have a combobox on th main form (TimeCards). I want to check if the field has been left blank before the user proceeds with anymore data entry. So on the Lost Focus event I have the following code:
If Len(Forms!TimeCards!cboEmployee & ""
= 0 Then
MsgBox "You must enter a valid EmployeeID before proceeding", vbinformationn + vbOKOnly
Dim frm As Form, cbo As ComboBox
Set frm = Forms![TimeCards]
Set cbo = Forms![TimeCards]!cboEmployee
cbo.Enabled = True
frm.SetFocus
cbo.SetFocus
End If
The problem I'm having is when the user leaves the combobox field blank, all other fields are located on the Subform (TimeCardsSubform). I can't get the set focus to focus back onto the combobox(cboEmployee) located on the Main Form (TimeCards) once it has gone onto the Subform. Can anyone offer a suggestion to get me focused back onto the combobox located on the Main form?
If Len(Forms!TimeCards!cboEmployee & ""
MsgBox "You must enter a valid EmployeeID before proceeding", vbinformationn + vbOKOnly
Dim frm As Form, cbo As ComboBox
Set frm = Forms![TimeCards]
Set cbo = Forms![TimeCards]!cboEmployee
cbo.Enabled = True
frm.SetFocus
cbo.SetFocus
End If
The problem I'm having is when the user leaves the combobox field blank, all other fields are located on the Subform (TimeCardsSubform). I can't get the set focus to focus back onto the combobox(cboEmployee) located on the Main Form (TimeCards) once it has gone onto the Subform. Can anyone offer a suggestion to get me focused back onto the combobox located on the Main form?