Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cursor Placement (A2K)

    The following code

    Public Function butDupeField()
    SendKeys "^'", True
    If Screen.ActiveControl.Name = "txtSerialNo" Then
    Screen.ActiveControl.SelStart = Len(Screen.ActiveControl.Text)
    End If
    End Function

    is executed when the Function Key F5 is pressed and works perfectly.

    What it does is copy a serial number from the previous record so that it can be modified without having to reenter to whole field.

    What happens exactly is that the previous serial number is duplicated, but it remains "highlighted" necessitating the need to "click" at the end of the field so that it doesn't get deleted and then backspacing to edit the previous number. A small thing, but slows down the workflow.

    What I would like to have happen is for the serial number to be duplicated and then have the cursor set at the end of the field so it could then be edited without "mousing".

    I've tried variations of the dreaded "SendKeys" without success.



    Any help with this problem would be appreciated,
    Cheers,
    Andy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cursor Placement (A2K)

    Try this:
    <code>
    Public Function butDupeField()
    SendKeys "^'", True
    If Screen.ActiveControl.Name = "txtSerialNo" Then
    SendKeys "{F2}"
    End If
    End Function
    </code>
    or perhaps simply
    <code>
    Public Function butDupeField()
    SendKeys "^'{F2}", True
    End Function</code>

  3. #3
    5 Star Lounger
    Join Date
    Nov 2001
    Location
    Toronto Canada
    Posts
    920
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cursor Placement (A2K)

    Hans,

    I both love it and find it frustrating when the solution is so easy. Thanks kindly,
    Cheers,
    Andy

Posting Permissions

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