Help with NotInList and BeforeUpdate please.

F

Fred Wilson

Hello all,

I might be doing things in the wrong order but here we go.

The cboEvent NotInList acDataErrAdded is triggering the form
BeforeUpdate event.

The problem is the form has two comboBoxes (cboEvent, cboLocation)

Private sub BeforeUpdate (truncated)

If me.cboEvent = 0 or isnull(me.cboEvent) then
MsgBox "Event Required", vbokonly
me.cboEvent.SetFocus
me.cboEvent.Dropdown
Cancel=True
exit sub
End if

if me.cboLocation = 0 or isnull(me.cboLocation) then
MsgBox "Location Required", vbOkOnly
me.cboLocation.SetFocus
me.cboLocation.Dropdown
Cancel=True
Exit Sub
End if

Me.txtOperator = UCASE(TRIM$(me.txtOperator))

End Exit

When I run the NotInList event for cboEvent and add the entered data
when RESPONSE = acDataErrAdded is reached I get the MsgBox for the
cboLoaction from the BeforeUpdate Event. Although it is correctly
identifying that no information has yet been selected for cboLocation,
it is doing it WAY too early.

The tab order is cboEvent, cboLocation, txtOperator, intParticipants.

Why is this happening? What can I do about it short of setting a public
variable?

Thank you,
Fred
 
Top