Copying text value

latex88

Registered User.
Local time
Today, 15:19
Joined
Jul 10, 2003
Messages
198
Hi,

This seems trivial for you as a code writer, but not so much for me :( I have this form where I am building that allows the users to update information. I want to, when the user, click inside of a value, it automatically highlights and copies that value, so that the user can paste it in another application to search for a record related to that value. Basically, I would like to shorten the process of highlighting the entire value and hit Ctrl C for copying. ".SetForcus" seems to highlight, but how do I copy the highlighted value? Thanks in advance for your help.
 
One way around it would be using the sendkeys statement to send CTRL+C to the form. You have to make sure the text is highlighted

SendKeys "^c"
 
You can use what is already available to you in VBA:
Code:
    With Me.[COLOR=Red]TextBox[/COLOR]
        .SelStart = 0
        .SelLength = Len(.Value)
    End With
    DoCmd.RunCommand acCmdCopy
Create a function based on the above, call it and pass the control object (or the control name) to the function and use that in the code.
 
Oh yea, vbaInet... I had forgotten that type of solution. I use that sort of code to support search-as-you-type into an unbound field intended for search text.
 
You can use what is already available to you in VBA:
Code:
    With Me.[COLOR=Red]TextBox[/COLOR]
        .SelStart = 0
        .SelLength = Len(.Value)
    End With
    DoCmd.RunCommand acCmdCopy
Create a function based on the above, call it and pass the control object (or the control name) to the function and use that in the code.

That worked beautifully. Thanks.
 

Users who are viewing this thread

Back
Top Bottom