Lazy Copy?

Tim L

Registered User.
Local time
Today, 22:36
Joined
Sep 6, 2002
Messages
414
Is it possible to copy the contents of a (or more) controls to the clipboard but clicking a form button, as opposed to highlighting the required contents of the control and then clicking on the 'copy' button.

Sound's lazy but if you want to copy the copy of contents of more than one field then the process can get long-winded. I know that you can combine the contents of more than one control in another control but this could take up more space on the form than I am prepared to give up.

Tim
 
Thanks for your quick reply.

Yes I did search but I could not find what I needed, and the link that you provided goes on about duplicating a record, whereas I want to copy to the clipboard.

To clarify: I would like to put a button on a form that highlights the contents of one or more fields and then copies the values in those fields to the clipboard, I will then paste this information into another application, such as a text editor.

Hope that this explains things better.

Tim
 
OK, work with me here. There is a way to do this, but requires some work, but if this is something done quite often and there are a lot of fields you can try.

1. On the Main form that has the fields you want copied, create an export button that brings up a pop up form. The pop up form will contain a list box with all the fields that can be copied from the main form:

Name
Address
ID
Etcc.

On the Pop form, make the list box enabled for multi-select, that way the user can select what fields they want copied.

2. Have an export button on the popup form which when clicked does the following. (I have to go back here. Create a temporary file tmpExport that has one field that is type memo)

A) Delete the contents of tmpExport
B) append the contents of the field selected to the tmpExport table:
For each lbField.ItemSeleted
memofield = memofield + lbfield.itemselected
End
C) use the OutputTo command to send the contents of the tmpExport to a text file instead of using the clipboard.

Sorry for this high level view. I'm assuming you know quite a bit of code (i.e For command, Deleting Rows from tables using a query, etc...). If I get a chance I'll log back on if you have other questions. Also there are a lot of very creative/knowledgeable people on this forum. They may know of a better more streamlined way to do what you want.
 
Last edited:
Hi theprez, thank you very much for the time you have taken to reply.

I could cope with the level of coding you suggested but the process would end up being longer than copying the data by using CTRL+C.

The database that I am using records reference sources that I am using for my studies so, for instance, I record a URL that I have visited and the date of the visit, in separate fields. (There are also other sorts of references, such as book/article+author+page etc, but the principle is the same for them.)

What I want to be able to do is to just click on a button that copies the predetermined and preformatted text, so there's no need for the pop-up form or anything fancy like that :), to the clipboard so that I can then insert them into any reports or emails that I needed them for.

Hopefully someone will have the answer, I figure that it must be possible, it is probably just hidden away somewhere...

Tim
 
Your original question did not state that you wanted to paste the data into another program. One alternative is to combine the fields into one and then copy that fields data to the clipboard. I use these commands to select one text box and copy it's value to the clipboard.

Me.MyTextBox.SetFocus
DoCmd.RunCommand acCmdCopy

That should get you started.
 
ghudson said:
Your original question did not state that you wanted to paste the data into another program.
True, but it did say that I wanted to copy data to the clipboard ;) I just ommited to say where I wanted the copy to go thinking that that information wasn't necessary and wanting to keep the request short.

Anyway, you've provided me with the answer now and it works just fine, so thank you very much for the response.

Cheers!

Tim
 

Users who are viewing this thread

Back
Top Bottom