Results 1 to 9 of 9
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-1 Jet 4.0)

    How to Move The Cursor After Entering A Character?
    A2k (9.0.3821) SR-1 Jet 4.0

    I have the following code in an after update that works fine if I enter a valid character and press the Enter or Tab key the cursor advance to the next control.

    What code can I add so when I type a chatacter if triggers the after update without having to press the Tab or Enter Key to move to the next control?

    Thanks, John

    Private Sub strCursorToCode_AfterUpdate()

    Select Case strCursorToCode
    Case "T"
    Me!strTicketNo.SetFocus
    Case "N"
    Me!strFirstName.SetFocus
    Case "O"
    Me!lngOutcomeID.SetFocus
    Case "P"
    Me!dtmPaidDate.SetFocus
    Case "L"
    Me!strLocation.SetFocus
    Case "C"
    Me!dtmCourtDate.SetFocus
    Case Else
    Me!strCursorToCode.SetFocus
    End Select

    End Sub

  2. #2
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    Instead of using the After Update event, try the On Change event.

    HTH
    Regards,

    Gary
    (It's been a while!)

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    Hi Gary

    If There is a T in the field and I type P it goes to strTicketNo, if I then type P again it goes to dtmPaidDate.

    I seems to go to the field of the previous character entered.

    Any other ideas?

    Thank, John

  4. #4
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    The AutoTab property of a control can be set so that when the last character of the field is typed it does not require a Return or Tab to goto the next field.
    Is this what you are looking for?
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    Hi Pat

    Thats exactly what I want, however my 1 character field is a combo box and AutoTab is not an option.

    Any other solutions?

    John

  6. #6
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    You can use the keydown event.

    Select case keycode
    case vbkeyT
    etc

    You will need to look up the keycode values in help
    Regards
    John



  7. #7
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    Does it need to be a ComboBox?
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  8. #8
    Silver Lounger GARYPSWANSON's Avatar
    Join Date
    Aug 2001
    Location
    Frederick, Maryland, USA
    Posts
    1,788
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    Why not set a variable in code that is updated after changing the combobox to the last letter entered such as right(comboboxvalue,1) and using that to trigger your case statement.

    I misunderstood your first statement. I thought you were just entering in one letter, not multiple letters.
    Regards,

    Gary
    (It's been a while!)

  9. #9
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to Move The Cursor After Entering A Character? (A2k (9.0.3821) SR-

    Thanks John

    That got it

Posting Permissions

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