Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2009
    Posts
    23

    Unanswered: setFocus inside lostFocus

    Hi,

    I have a text box named txtBox. Is it possible to setFocus inside the txtBox_LostFocus routine. I want to do this because when a wrong field is entered, cursor should be present in txtBox to reenter.

    I kept the txtBox.SetFocus in error condition of txtBox_LostFocus. But still cursor is pointing to next textbox field even though wrong data is entered. Can any one let me know on how to resolve this. Thanks.

  2. #2
    Join Date
    Feb 2004
    Location
    Swindon, UK
    Posts
    86
    add your code under the next items GotFocus routine.

    i.e.
    Private Sub Text2_GotFocus()
    If Me.Text0.Value <> "True" Then Me.Text0.SetFocus
    End Sub
    "Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done."

  3. #3
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    I would use the before update event instead:

    Before update
    Paul

  4. #4
    Join Date
    Jun 2009
    Posts
    23
    Thanks for your help. It worked for me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •