Solved

MS Access question

Posted on 2016-10-06
11
76 Views
Last Modified: 2016-10-07
I would like to create a copy button, just select field and copy text.
would you advise me?
Snap1277.jpg
0
Comment
Question by:Tony T
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
  • 2
  • +1
11 Comments
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41832243
copy to where? (clipboard?)
0
 

Author Comment

by:Tony T
ID: 41832316
yes
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41832327
Dim clipboard As MSForms.DataObject
Set clipboard = New MSForms.DataObject
clipboard.SetText your source field (i.e. your text box)
clipboard.PutInClipboard
1
Get Database Help Now w/ Support & Database Audit

Keeping your database environment tuned, optimized and high-performance is key to achieving business goals. If your database goes down, so does your business. Percona experts have a long history of helping enterprises ensure their databases are running smoothly.

 

Author Comment

by:Tony T
ID: 41832392
I'm getting this error.
Snap1278.jpg
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41832410
did you set a reference to the library?
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41832417
For using MSForms.DataObject in your code you need library “Microsoft Forms 2.0 Object Library”

Some­times you won’t find the desired ref­er­ences in the list, say you won’t find “Microsoft Forms 2.0 Object Library” in the tool/reference list in that case you need to browse the FM20.DLL file from the system32
0
 
LVL 7

Expert Comment

by:COACHMAN99
ID: 41832424
Also, I would not use 'copy' as your field name. try txtCopy or some other non-system / non-reserved word. - this isn't related to your error message, just a note :-)
0
 
LVL 48

Expert Comment

by:Dale Fye (Access MVP)
ID: 41832679
Why not simply use the built-in right click menu?
0
 
LVL 50

Accepted Solution

by:
Gustav Brock earned 500 total points
ID: 41833066
It is much simpler. No reference is needed:
Private Sub ButtonCopyToClipboard_Click()

    Me!YourTextboxName.SetFocus
    Me!YourTextboxName.SelLength = Len(Me!YourTextboxName.Text)
    DoCmd.RunCommand acCmdCopy
    
End Sub

Open in new window

/gustav
0
 

Author Closing Comment

by:Tony T
ID: 41833760
thank you
0
 
LVL 50

Expert Comment

by:Gustav Brock
ID: 41833779
You are welcome!

/gustav
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question