473,473 Members | 1,848 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Copy field contents using DblClick action

lwwhite
16 New Member
(Access 2003) Here's what I want to do: enable users to double-click a field in a datasheet-view subform and thereby save the contents of that field to the Windows clipboard so that they can then paste it into another field. I tried to set it up as a DblClick event on the field with this syntax:

DoCmd.DoMenuItem acFormBar, acEditMenu, acCopy, , acMenuVer70

However, when I tested, I got a message that the Copy action wasn't available. So then I changed it to a KeyDown event, meaning users have to double-click THEN press a key to copy the data. This works, but I'd really like to copy with just a double-click.

What am I missing?
Dec 14 '06 #1
3 5377
NeoPa
32,556 Recognized Expert Moderator MVP
I would guess that it only works when the field you want is the active control.
I never use macros so this is not an area I understand very well.
Dec 14 '06 #2
missinglinq
3,532 Recognized Expert Specialist
The Copy Action wasn't available because you had no text selected to copy! This code sets the cursor to the beginning of the text box, selects all of the text and then carries out your copy action:

Expand|Select|Wrap|Line Numbers
  1. Private SubYourTextBoxName_DblClick(Cancel As Integer)
  2.     Me.YourTextBoxName.SelStart = 0
  3.     Me.YourTextBoxName.SelLength = Len(Me.YourTextBoxName.Value)
  4.     DoCmd.DoMenuItem acFormBar, acEditMenu, acCopy, , acMenuVer70
  5. End Sub
  6.  
Tested in Access2000.
Dec 14 '06 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Thanks ML for covering my arse.
Good answer.
Dec 14 '06 #4

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

Similar topics

4
by: MT | last post by:
Hi all, this sounds like an easy enough thing to do, but after spending 45 minutes searching google and various javascript sites I can't find out how to make a textfield (textbox or whatever you...
6
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo...
15
by: Sourcerer | last post by:
Hi all. Can I do this to duplicate the contents of struct a in struct b struct myStruct a, b, *aptr, *bptr; aptr = a; bptr = b; Do something to initialize contents of structure a...
13
by: John | last post by:
Hi How can I implement cut or copy or paste in code? Thanks Regards
7
by: lgbjr | last post by:
Hello All, I¡¯m using a context menu associated with some pictureboxes to provide copy/paste functionality. Copying the image to the clipboard was easy. But pasting an image from the clipboard...
12
by: Mark E. Fenner | last post by:
Hello all, I have a code where my inner loop looks like: allNew = for params in cases: newObj = copy(initialObject) newObj.modify(params) allNew.append(newObj) return allNew
17
by: Steve | last post by:
I'm trying to code cut, copy, and paste in vb 2005 so that when the user clicks on a toolbar button, the cut/copy/paste will work with whatever textbox the cursor is current located in (I have...
3
by: =?Utf-8?B?R3JlZyBN?= | last post by:
Hello, I'm running an asp.net, intranet web application using .net framework 1.1 on IIS5.1 / 6.0. Through the web application, I would like to press a button on the web page, have another window...
3
by: ali3n8 | last post by:
I am using a search form that list records in my database. On the list that shows the records that have been found I have a field called First. When I double click on this field I would like to open...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.