By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,985 Members | 2,884 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,985 IT Pros & Developers. It's quick & easy.


P: 1
I would like to have two fields on my for be copied to the clip board either by moving to the next field (preferred)or using a button placed next to the field. the paste will occur in another application so right click and paste in that application will work though it would be fantastic if the cut and paste could work on exiting the field or clicking the button
Mar 5 '12 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 100+
P: 2,321
I just recently started using Access 2010, so I dont really know if this command was available in earlier versions.

You can use Docmd.RunCmd AccmdCopy to copy selected text to the clipboard like so:
Expand|Select|Wrap|Line Numbers
  1. Private Sub txt_ExampleCopyFrom_LostFocus()
  2.    If Not IsNull(Me.txt_ExampleCopyFrom) Then
  3.       Me.txt_ExampleCopyFrom.SelStart = 0
  4.       Me.txt_ExampleCopyFrom.SelLength = Len(Me.txt_ExampleCopyFrom)
  5.       DoCmd.RunCommand acCmdCopy
  6.    End If
  7. End Sub
This will however only copy 1 field to the clipboard, not 2. If you need more advanced copying where you more selectively choose what to copy, you can try the code by Terry Kreft found at:
Clipboard API
Mar 5 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.