Solved

MS Access question

Posted on 2016-10-06
11
77 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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
ID: 41832679
Why not simply use the built-in right click menu?
0
 
LVL 51

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 51

Expert Comment

by:Gustav Brock
ID: 41833779
You are welcome!

/gustav
0

Featured Post

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

615 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