473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

"COPY AND PASTE" Macro Event

Hi There..
What is the Macro or Code Builder Event, For Copying And Pasting.
i.e:

I need to click on a field in a textbox, and it must be copied jus by clicking on it.
Then I want to click on an empty textbox, and the field I copied must get pasted...

How do I go About doing this?
XL
Sep 1 '09 #1
3 22948
ChipR
1,287 Expert 1GB
I suppose you could use a form variable or a hidden textbox as a "clipboard" and copy the value of a text box to it when clicked. Then when the other text box is clicked, copy the value out of your clipboard.
Sep 1 '09 #2
missinglinq
3,532 Expert 2GB
Can't really thik of a valid reason for doing this, but this code will work:

Expand|Select|Wrap|Line Numbers
  1. Private Sub FirstTextBox_DblClick(Cancel As Integer)
  2. If Not IsNull(Me.FirstTextBox) Then
  3.   FirstTextBox.SelStart = 0
  4.   FirstTextBox.SelLength = Len(Me.FirstTextBox)
  5.   DoCmd.RunCommand acCmdCopy
  6. End If
  7. End Sub
  8.  
  9. Private Sub SecondTextBox_DblClick(Cancel As Integer)
  10. If Not IsNull(Me.FirstTextBox) Then
  11.   DoCmd.RunCommand acCmdPaste
  12. End If
  13. End Sub
  14.  
You really have to use the DoubleClick event for this. Using the OnClick event for a textbox to do something like this means that the user couldn't click into the textbox to enter data, very user un-friendly.

Perhaps a little more explanation of your exact intent here would help us to better help you.

Linq ;0)>
Sep 1 '09 #3
OldBirdman
675 512MB
I agree with Linq here, that this is user un-friendly. I would have a "Copy" command button next to the textbox to be copied. Although this would require an additional line of code "FirstTextBox.SetFocus" between lines 2 & 3, it would not do the automatic copy when such would be a hinderance.

The Click Event occurs when a mouse button is pressed and released. Therefore, a user could select part of the text in FirstTextBox, but the entire text would be copied to the Clipboard. This is a behavior not standard to Windows, and because it is unexpected, might result in user-error.

Can't really thik of a valid reason for doing this, but this code will work:
I can and do use variations of this logic to lessen the number of keystrokes/mouse operations where copy/paste is used very frequently between related textboxes. However, I am VERY careful to avoid conflicts between this behavior and the Windows Clipboard.
Sep 1 '09 #4

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

Similar topics

0
by: Kevin Schneider | last post by:
Please forgive me if this is a bit off topic, but I haven't had any takers in other forums. With ASP.NET projects, is it possible to have VS.NET automatically change the configuration options of...
0
by: Tom Clement | last post by:
Hi folks. I have a question about "Copy Local". We have quite a few projects in our solution (35) and some of them reference the very large "Microsoft.mshtml.dll". I was wondering why leave...
2
by: interuser | last post by:
I want to automate deployment that I now do using the "copy project" button. Is there a script that does this or ideas how to make one? I do not want to make a deployment project or use xcopy ,...
0
by: tom777 | last post by:
For some ASP.NET projects, after I have been working on them awhile the "Copy Project..." stops working when I try to copy the project to the web server, which is on another machine. The error...
4
by: Don Wash | last post by:
Hi There! I'm using "Copy Project" function of VS.NET to upload my ASP.NET application to my web server (not my own web server) and they have Front Page Server Extensions installed as well....
1
by: Knepper, Michelle | last post by:
Hi out there, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I don't...
2
by: Knepper, Michelle | last post by:
Hi, I'm a first-time user of the "Copy ... From..." command, and I'm trying to load a table from a text flat file. http://www.postgresql.org/docs/7.4/static/sql-copy.html I'm getting the...
3
by: ammie65 | last post by:
I have been trying to create a purchase order database in Access, and I have been successful in creating all the tables, queries and reports that I need. I have only one issue: I need to copy the...
4
by: | last post by:
Using VS.NET I am wondering what methods developers use to deploy ASP.NET website content to a remote server, either using FTP or network file copy. Ideally there would be a one-button or...
7
kcdoell
by: kcdoell | last post by:
Good morning everyone: I created a form and set the default view as a continuous form. Basically the form is displaying records in which the user can add or edit new ones. The record source for...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.