Cut and paste function

annemu

Registered User.
Local time
Today, 15:55
Joined
Nov 10, 2008
Messages
16
Hi all,
I have been looking for this function within these forums, but cannot find it. Basically, I have a form which contains groups of usernames (within subforms) When I want to change a user from one group to another, I would like to use a cut/paste function. What I want to do is : When the user of the form double-clicks on the text box, then the text within that box is cut and then when they click into another text box on a different subform, the text is pasted.
I would like to use "drag and Drop" but not possible in access.
icon13.gif

If anyone can help I would be very happy.
P.S. I did try the "DoCmd.RunCommand acCmdCut" but this only seems to work within the "On Enter" event and not on double click event of the control
 
Why not use a global variable as your own clipboard?
 
Thanks HiTechCoach,

I guess that it's the form event that has me snookered! The Cut function did not work when I wanted it to. Does using a global variable overcome this? How would I use it? (I have only very basic coding skills - learning as I go)

In this case I have decided to do a less complicated maneuvre involving indexes and updating of indexes. Not as slick looking, but couldn't afford to spend the time trying to figure it out. I would appreciate your advice tho' as if I can use it again, then I will!

Cheers
Anne
 
Thanks HiTechCoach,

I guess that it's the form event that has me snookered! The Cut function did not work when I wanted it to. Does using a global variable overcome this? How would I use it? (I have only very basic coding skills - learning as I go)

In this case I have decided to do a less complicated maneuvre involving indexes and updating of indexes. Not as slick looking, but couldn't afford to spend the time trying to figure it out. I would appreciate your advice tho' as if I can use it again, then I will!

Cheers
Anne
Hi Anne
I've used DoCmd.RunCommand acCmdCopy (in my case I wanted to concatenate several address elements for copy/paste to Word). But in order to make it work I created a separate invisble unbound text box. So then the on doubleclick event would do the following:

Copy the required information to the unbound text box (using just the form references)

Set the unbound text box to visible

Set the focus to the unbound text box

Run the acCmdCopy

Set the focus back to my text box that I'm double clicking on

Make the unbound text box visible again


here is my code:

Code:
    DoCmd.Echo False

    Me![AddressBox].Value = (Me![Account_Name].Value + vbCrLf) & (Me![Address_1].Value + vbCrLf) & (Me![Address_2].Value + vbCrLf) & (Me![Address_3].Value + vbCrLf) & (Me![Town].Value + vbCrLf) & (Me![County].Value + vbCrLf) & (Me![Post_Code].Value + vbCrLf)
    
    Me![AddressBox].Visible = True
    Me![AddressBox].SetFocus
    
    DoCmd.RunCommand acCmdCopy
    
    Me![Account_Name].SetFocus
    Me![AddressBox].Visible = False
    
    DoCmd.Echo True

I guess for your purposes you would just need to delete the contents of the text box in order to mimic the "cut".

hth
Chris
 
Thanks for your useful information which posted here..
 

Users who are viewing this thread

Back
Top Bottom