1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12:
Private Sub CustId_LostFocus() Dim varLength As Variant varLength = Len(CustId.Value) If IsNull(varLength) = True Then MsgBox ("You must enter a Cust ID.") CustId.SetFocus Exit Sub End If End Sub
1: 2: 3: 4: 5: 6: 7: 8:
Private Sub NextControl_Enter() ' If CustId is blank, If IsNull(CustId.Value) Or Len(Trim(CustId.Value)) = 0 Then ' warn the user and set the focus to CustId MsgBox ("You must enter a Cust ID.") CustId.SetFocus End If End Sub