Move focus off combo from NotInList

stardusty

Registered User.
Local time
Today, 15:25
Joined
Jun 14, 2002
Messages
18
I have a combo box pulling a record from a table other than the one the form is sourced to. Users look for client's in the dropdown to automatically populate a set of the form's text boxes.

At times the user will type into the combobox in search of a client, who happens not to be in either of the tables. I have customized the message that comes up, no need to requery since the table the combobox is readonly.

What I cannot figure is, how to move the focus off the combobox when there is no client in the list from the integral table. SetFocus throws me into an irreversible loop.

Private Sub FindClientRecord_NotinList(NewData As String, Response As Integer)

Dim ans As Long
ans = MsgBox("You have entered....")
Me.Undo
Response = acDataErrContinue

End Sub


The cboFindClientRecord, does have the following in after update:
Me!CountyClientID = FindClientRecord].Column(0)
Me!LastName = Me![FindClientRecord].Column(2)
Me!FirstName = Me![FindClientRecord].Column(3)
Me!DOB = Me![FindClientRecord].Column(4)
 
Try this:

Private Sub FindClientRecord_NotinList(NewData As String, Response As Integer)

MsgBox "This entry does not exist."
Me.FindClientRecord.Undo
Response = acDataErrContinue
Me.MyField.SetFocus

End Sub

Change MyField to field you want to set the focus to....

hth,
Jack
 
Jack,
Thanks. Works like it should.
Brent
 
Jack ... you and your "fields" .....

LOL .... "controls" ... Jack "controls" ... LOL

"Fields" are in Tables and Queries ... "Controls" are on Forms and Reports.

RDH
 
I get it right about 87% of the time Ricky, but you only see the dang 13%! I am doomed....LMAO!!!!

Jack
 

Users who are viewing this thread

Back
Top Bottom