Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Keep cursor in current control problem

Status
Not open for further replies.

RAWC

Technical User
Dec 14, 2001
32
US
I am working on a database that if the user selects "Other" for certain fields, a text box then becomes visible. At that point, the newly visible field becomes required. I am having problems returning focus to that field. I enter the control and do not enter any text, but tab out of it. My code runs fine, with message displaying, but the next control on the tab order is still getting the focus. I have tried placing this code in every imaginable place (BeforeUpdate, etc) with no luck. Here is the code.
Private Sub txtOtherPOB_LostFocus()
'If user does not enter value, send message and set focus.
If txtOtherPOB.Text = "" Then 'Other not typed in
If PlaceOfBirth.Value = "Q" Then 'Other selected
MsgBox "Other Place of Birth must be entered"
txtOtherPOB.SetFocus
Exit Sub
End If
Else
Exit Sub
End If
End Sub

Any help would be greatly appreciated!
Thanks!
 
Thanks to the Judge! Solved by
thread702-474982
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top