Results 1 to 7 of 7
  1. #1
    TriFith is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2013
    Location
    Czech republic, Prague
    Posts
    37

    btn macro what can copy text to clipboard

    Hello everyone,


    I have met a situation what I canīt solve on my own in MS Access...
    Hope, someone of you can help me...

    I have a button in form and I need to add onClick procedure/vb script what will just copy collected data to clipboard.
    There are some data entered by user, background functions and other macros in form will get the "result" on a text box (set as invisible in form view).
    Now I need to copy this result to clipboard, to allow user to switch the window (unfortunatelly another application where I canīt link to) and just hit CTRL+V to paste the result...

    Is this possible by MS macro command, or VB script?
    At this time, I can only export the result to xls (for example) and there user can copy&paste it, but I would like to exclude this annoying and time-consuming step.

    Thank you for your help.

    Regards
    TriFith

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    look to the bottom of your thread and you will see half a dozen threads on the same subject

  3. #3
    TriFith is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2013
    Location
    Czech republic, Prague
    Posts
    37
    Thank you for your comment Ajax,
    I am aware of those topics, but I didnīt find how to solve it when TextBox is hidden.
    When Me!Result.SetFocus command is exetuced,, error occures...

    Any other way to do this?

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    not sure why you need to setfocus - just refer to the control, the fact it is hidden is immaterial. Suggest show the code you are trying to use

  5. #5
    TriFith is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2013
    Location
    Czech republic, Prague
    Posts
    37
    Code:
    Private Sub Command101_Click()
    Me!PM_C.SetFocus
    DoCmd.RunCommand acCmdCopy
    End Sub
    If there is an option how to refer to value of TextBox directly, I would need an advice with code...

    Thanks

  6. #6
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    I would need an advice with code...
    say you have a textbox called txtName. In code you would refer to it a txtName or me.txtName e.g.

    You use

    me.txtName.setfocus
    me.txtName.text="myName"

    I would just use

    txtName="myName"

    or

    me.txtName="myName"

  7. #7
    TriFith is offline Advanced Beginner
    Windows XP Access 2010 32bit
    Join Date
    Aug 2013
    Location
    Czech republic, Prague
    Posts
    37
    Sorry, I have made some other changes and I have changed the name of textBox.
    My textBox is called PM_C now...

    You use

    me.txtName.setfocus
    me.txtName.text="myName"

    I would just use

    txtName="myName"

    or

    me.txtName="myName"
    I am not sure if I understand...

    I need to copy value of TextBox (named PM_C) to clipboard...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Copy To Clipboard - Max Length?
    By fredz in forum Access
    Replies: 3
    Last Post: 05-31-2014, 02:03 PM
  2. Copy items in a column to the clipboard
    By kevinscomp in forum Access
    Replies: 1
    Last Post: 08-07-2013, 06:57 PM
  3. Replies: 4
    Last Post: 06-21-2012, 11:43 AM
  4. Use VBA to copy table contents to the clipboard?
    By Deutz in forum Programming
    Replies: 3
    Last Post: 10-21-2010, 10:59 PM
  5. Replies: 1
    Last Post: 03-13-2010, 08:38 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums