Not In List event flawed?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a combo box for selecting customers. The table field is
"required". The combox box has the limit to list property set to YES & the
not in list event is set up to open a form to add a new customer. All works
fine, except that I just recently noticed that if I "tab" past the combo box
without entering anything, the not in list event is NOT triggered & I don't
get notified about the lack of an entry in Cust_ID until focus transfers to a
subform - which occurs after I have entered data in several other controls on
the main form.
I have tried every event I can think of to trap a null entry in the
combo box & can get it to "sort of work", but I would like to be able to
cleanly trap this and keep focus on the combo box until a valid entry is made.
Any help would be greatly appreciated.
Garry Gross
 
Ricky,
checking for IsNull or IsEmpty in the Before Update event does not work.
If I hit Tab or Enter without entering anything, focus "happily" moves on to
the next control. I would like to trap this before focus goes to the next
control.
Garry
 
Ricky,
checking for IsNull or IsEmpty in the Before Update event does not work.
If I hit Tab or Enter without entering anything, focus "happily" moves on to
the next control. I would like to trap this before focus goes to the next
control.
Garry

Does this help?
Code the Combo Box Exit event:
If IsNull(Me![ComboName]) or Me![ComboName] = "" Then
MsgBox "You must enter a value." ' Optional message
Cancel = True
End If
 
fredg,
Thanks, it works. I think it was the
Cancel=True
that solved the problem. I was trying:

If IsNull(Me.cbo_Cust) Then
mbrResponse = MsgBox("Need to select Customer" , vbOKOnly, "Enter
Customer")
Me.cbo_Cust.SetFocus
End If

The SetFocus just did not work, I have not heard about the "Cancel"
instruction before, but when I changed "Me.cbo_Cust.SetFocus" to
"Cancel=True" it worked the way I wanted.

Garry


fredg said:
Ricky,
checking for IsNull or IsEmpty in the Before Update event does not work.
If I hit Tab or Enter without entering anything, focus "happily" moves on to
the next control. I would like to trap this before focus goes to the next
control.
Garry

Does this help?
Code the Combo Box Exit event:
If IsNull(Me![ComboName]) or Me![ComboName] = "" Then
MsgBox "You must enter a value." ' Optional message
Cancel = True
End If
 
Back
Top