Results 1 to 9 of 9
  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Copy (Access 2K)

    Afternoon All,

    I have a text field on a form (txtPrecert). I have a cmdButton. I wish to click on the cmdButton and copy the text from txtPrecert. What is the code for that please?

    Thanks.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy (Access 2K)

    What do you want ?
    Do you want to copy it to the clipboard ? To another textbox on the same form ? To another form ? To another record ?
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy (Access 2K)

    Thanks for the response and sorry for not clearing that up further.....to the clipboard please.

    Thanks again.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy (Access 2K)

    You can find the code for this at this page of The Access Web.
    Francois

  5. #5
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy (Access 2K)

    Thanks for the suggestion....please forgive me....but I'm not sure I understand this. I know to put this in a module but how does it know what field (in my case txtPrecert) to copy? Not sure what to do once I put the code in a module. I know I'm asking an awful lot here....but could you or someone else provide a little assistance here?

    Again....thanks so much.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

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

    Re: Copy (Access 2K)

    Hi Roberta,

    You can use the function Clipboard_SetText from the Access Web to copy the text to the clipboard. Say that your command button is named cmdCopy. The On Click event procedure for the button could look like this:

    Private Sub cmdCopy_Click()
    Clipboard_SetText Me.txtPrecert
    End Sub

    You can test it by entering some text in txtPrecert, then clicking the button. If you open another application such as Word or Excel, you should be able to paste the text.

  7. #7
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy (Access 2K)

    Hello Again,

    Guess I'm just one lame duck here.....I'm certain I've done everything right (but of course the obvious)....Put the code in a module and named it basCopyText. Put Han's suggestion (Clipboard_SetText Me.txtPrecert) in the onClick event of cmdCopyText. I have an unbound textbox named txtPrecert. When I click on cmdCopyText I get the following error msg:

    The expression you entered has a field, control or property name that Access can't find.

    Now what on earth have I gone and done wrong now? Any ideas are most appreciated!

    Thanks.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  8. #8
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Copy (Access 2K)

    OK....I got it....the field (in this case txtPrecert) must be a bound field. Once I changed it to a bound field all work very nicely.

    Thanks all for all the efforts.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

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

    Re: Copy (Access 2K)

    I'm glad you got it to work, but it should have worked with an unbound text box too (that's what I tested the code on, actually).

Posting Permissions

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