473,387 Members | 1,791 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,387 software developers and data experts.

Copy/Paste Extra

Dear All,

As is my want I need to do something in Access that seems simple but
cannot fathom out.

I have main form with two subforms, both datasheets with an almost
identical table structure.

I want to add the functionality to copy records from subformA to
subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
make certain changes to the data from subformA before appending it into
subformB

1) Ctrl-C + Ctrl+V. Cannot work because additional changes are needed
2) Adding an extra field to the source table in subformA to indicate
those I need copying. Would work but I DO NOT want to add any more
"unnecessary" fields to my database.
3) Using a "COPYRECORDS" button on main form. Does not work even though
though I can select the required records, as soon as I press another
button those records become unselected
3) Using right-hand-mouse button. Probably would work but I have no idea
how to identify which records have been selected via the record
selectors

Do anyone have any ideas?

Sean
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
1 2530
Sean Howard wrote:
Dear All,

As is my want I need to do something in Access that seems simple but
cannot fathom out.

I have main form with two subforms, both datasheets with an almost
identical table structure.

I want to add the functionality to copy records from subformA to
subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
make certain changes to the data from subformA before appending it into
subformB

1) Ctrl-C + Ctrl+V. Cannot work because additional changes are needed
2) Adding an extra field to the source table in subformA to indicate
those I need copying. Would work but I DO NOT want to add any more
"unnecessary" fields to my database.
3) Using a "COPYRECORDS" button on main form. Does not work even though
though I can select the required records, as soon as I press another
button those records become unselected
3) Using right-hand-mouse button. Probably would work but I have no idea
how to identify which records have been selected via the record
selectors

Do anyone have any ideas?

Sean


Look at SelHeight and SelTop to determine rows selected if using record
selectors.

You might be better off writing a routine to copy the records. The
routine I use gets field names from the rows selected. This could be
used to capture the keys in Table1. Then write an append query to copy
the fields in Table1 to Table2. Or use a recordset to write to Table2.
Or write a routine to go to a new record in Table2's form and write
the data.

Here's an example, without the adding of records.

Option Compare Database
Option Explicit
Dim intTopRow As Integer
Dim intRowCnt As Integer

Private Sub CommandSelected_Click()
'I created a button to display the values contained in the
'field Item from the records selected. To test this out, change
'the name of ListItems to the name of your form. Change Me.Item
'to the name of a field you want to display.

'The problem, if you select records and then click on a command button
'the selection is removed. Thus I use the MouseDown event to capture
'the top row and number of rows. This would not occur if you use a menu
item to do the copy and then you would not need the mousedown event.

Dim intFor As Integer
Dim strMsg As String
DoCmd.GoToRecord acDataForm, "ListItems", acGoTo, intTopRow
For intFor = 1 To intRowCnt
strMsg = strMsg & Me.Item & Space(5)
DoCmd.GoToRecord acDataForm, "ListItems", acNext, 1
Next

MsgBox strMsg

End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
'I used the mouse down event to capture the top/botton row of the
'selected records. These values will be used
intTopRow = Me.SelTop
intRowCnt = Me.SelHeight
End Sub

Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Legendary Pansy | last post by:
I was checking out the 101 C# Samples, specifically Windows Forms - Use the Clipboard. I took a look at the code for a while, and I understand what the program is doing with the cut, copy, pasting...
3
by: Rachel Suddeth | last post by:
This may not be the right forum, but it's a problem I chiefly come across when trying to post here. When I do a copy/paste from VS, the text always looks really weird (and even if I'm in an...
2
by: Matt | last post by:
Hello, I have a copy button and a paste button. What code should I add to the copy button and the paste button to do it's work? Thanks, Matt
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...
5
by: Kaur | last post by:
Hi, I have been successful copying a vba code from one of your posts on how to copy and paste a record by declaring the desired fields that needs to be copied in form's declaration and creating two...
6
by: Ben R. | last post by:
Hi, I've got a vb.net winforms app. Out of the box, I can use Ctrl X, C and V as expected in controls like textboxes. I've got a menustrip, and if I click the link "Add standard items" which...
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...
5
by: phill86 | last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in...
8
by: jh | last post by:
I'd like to copy/paste into a listbox during runtime. I can do this for a textbox but can't figure out how to accomplish this for a listbox. Any help? Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.