Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying multiple items to clipboard 2

Status
Not open for further replies.

bigdrewecu

Programmer
Apr 20, 2004
14
US
I was wondering if anyone had any ideas on copying multiple items such as first name ,last name, state, address that were in a text box on the form level to the clipboard.
 
Hi!

To copy the contents of one control to the clipboard, try:

[tt]me!txtYourControl.setfocus
docmd.runcommand accmdcopy[/tt]

The settings in Tools | Options for "Behavior entering field" should probably be "Select entire field".

Else, to copy the contents of one record, try:

[tt]docmd.runcommand accmdselectrecord
docmd.runcommand accmdcopy[/tt]

- then in the appropriate program, choose Paste, CTRL+V...

I'm not sure, but I think to only copy selected items, you'd have to use some more advanced methods (unless you do it a bit dirty and concatinate them into one textcontrol, then perform the first suggestion;-))

BTW - I see this is your first question here. Welcome to Tek-Tips! Here's a little faq on how to get the most out of the membership faq181-2886. Good Luck!

Roy-Vidar
 
see the thing is that would work but it throws in alot of unecessary information that i dont need to copy to the clipboard. which all i need is mailing information
 
You might consider using Roy's dirty method, which at least in my opinion, is not that dirty, by creating a textbox and setting it's ControlSource, or just assigning the value as follows:
Code:
=Trim([txtAddr] & " " & Trim([txtCity]) & " " & Trim([txtState]) ...
Me!txtYourControl.SetFocus
DoCmd.RunCommand acCmdCopy
Unfortunately, you cannot use a hidden control because you can't set focus to a hidden control, but you can cover the control with a box, filled in to the background color of the screen.

You can do it without using a control, but it is a more complex approach.

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top