Results 1 to 8 of 8

Thread: SetFocus

  1. #1
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Unanswered: SetFocus

    I have a textField, in its on_Exit event , I check the input data, and make some coparison, then I want to be able to come back to the same filed if the data entry was wrong, I used .SetFocus but it didn't fire. I think because it is written in the on_Exit event. What can be done to avoid such situation.
    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259

    Re: SetFocus

    Try on its On Exit function; that would most prob. work
    or is On Change

  3. #3
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: SetFocus

    Originally posted by Jerrie
    Try on its On Exit function; that would most prob. work
    or is On Change
    I've already used the On_Exit event, by on_Change it would fire the function by evrey key press, which is not right because the input is not yet completed.

  4. #4
    Join Date
    Jan 2004
    Location
    Toronto, Canada
    Posts
    259

    Re: SetFocus

    When i tried it out, yeah, the setfocus doesn't work; everytime it went to the next object in line and gave it focus; so to get past that, i did this

    text0 <- text in question

    text1 <- the next object in line to get focus

    set up a flag boolean in text0 and set it to true

    in text1 . GotFocus() function,
    if flag = TRUE then
    Me.Text0.SetFocus
    End if

    and it worked!

  5. #5
    Join Date
    Jan 2004
    Location
    Houston, Texas
    Posts
    5
    How about using the Before Update Event for the control? If you do your comparison there, you can return a Cancel (Integer). This should keep you within the same Control.

  6. #6
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Thank you for bouth nice suggestion, I tried them and pleased.

    Thanks

  7. #7
    Join Date
    Aug 2003
    Posts
    47
    Why don't you set up some validation rules? Access keep the focus on the control until the validation rules satisfied.
    F..ck it, gimme a beer... Jimi Hendrix RULES!

  8. #8
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by sup
    Why don't you set up some validation rules? Access keep the focus on the control until the validation rules satisfied.
    Because the comprisons I do, are not alwas the same, it depends on what the user input in some textBoxes, also if I make the validation per VB, it functions but slowly.

Posting Permissions

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