473,545 Members | 2,388 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to copy a recordset!?!?!

Tlm
Hello All,

I have a form (FrmA) with a subform (SubFrmB) embedded in it. SubFrmB also
has a subform embedded in it (SubFrmC) The form's recordsource is based on a
table (TblA). SubFrmB's recordsource is also based on a table (TblB).
SubFrmC's recordsource is also based on a table (TblC).

There is a one-to-many relationship between TblA (one) and TblB (many).
There is a also a one-to-many relationship between TblB (one) and
TblC(many). The forms are similarly linked.

I want to be able to copy the recordset in SubFrmB - along with its many
records in SubFrmC - so I can then insert that recordset as a new record in
FrmA.

I considered using the RecordsetClone function for this. But since the
RecordsetClone property setting makes a copy of the underlying table
specified by the form's RecordSource property, that won't work for me since
there are three tables in play here.

Any and all suggestions on how I could possibly accomplish this would be
GREATLY appreciated!

Thanks!!!

Tom
Nov 12 '05 #1
3 8339
"Tlm" <t.*******@comc ast.net> wrote in
news:hvdsb.1747 80$Fm2.153056@a ttbi_s04:
Hello All,

I have a form (FrmA) with a subform (SubFrmB) embedded in it.
SubFrmB also has a subform embedded in it (SubFrmC) The form's
recordsource is based on a table (TblA). SubFrmB's
recordsource is also based on a table (TblB). SubFrmC's
recordsource is also based on a table (TblC).

There is a one-to-many relationship between TblA (one) and
TblB (many). There is a also a one-to-many relationship
between TblB (one) and TblC(many). The forms are similarly
linked.

I want to be able to copy the recordset in SubFrmB - along
with its many records in SubFrmC - so I can then insert that
recordset as a new record in FrmA.
What you want to do is only possible if the three tables have
identical structures. You are seesntially talking that you want to
copy a row from table B into Table A and the row(s) from Table C
into table B. If your tables are identical, they should be merged
into 1. then you don't need to copy anything, just find the row in
form B and give instruction to form A to move to that row.

I considered using the RecordsetClone function for this. But
since the RecordsetClone property setting makes a copy of the
underlying table specified by the form's RecordSource
property, that won't work for me since there are three tables
in play here.

Any and all suggestions on how I could possibly accomplish
this would be GREATLY appreciated!
I think we need to understand the purpose of your forms so that we
can find an alternative solution.

Bob Q.
Thanks!!!

Tom


Nov 12 '05 #2
Tlm
Bob,

Thank you for your posting. The situation I'm facing with this issue is
this:

This database tracts publications. The main form (FrmA - TablA) maintains
data regarding an overall ORDER to be sent to a printer; order #, name,
date, etc. The subform in the order form (SubFrmB - TblB) maintains data
regarding particular JOBS in the order; colors to be used, paper weight,
etc. (there are often 20 or more jobs to an order). The subform in the jobs
subform maintains data regarding the DISTRIBUTION of the jobs; how many go
here, how many go there, etc. (there are often 20 or more separate
distribution destinations for each job).

Many jobs are often very similar, but have one or two different values in
some fields. The user wants to be able to 'copy' a job (along with its
distribution data) and 'paste' it in a new order - then modify as required.
The intent is to save the user all that redundant data entry, and potential
type-Os, (there are over 50 fields on the job - SubFrmB - form alone). So,
it's not exactly redundant data. But nearly.

I take your point about there being actually THREE recordsets here. And
your recommendation that I use three separate append queries sounds logical.
But how?

Thank you again!!!

Tom



"Bob Quintal" <bq******@gener ation.net> wrote in message
news:b1******** *************** *******@news.te ranews.com...
"Tlm" <t.*******@comc ast.net> wrote in
news:hvdsb.1747 80$Fm2.153056@a ttbi_s04:
Hello All,

I have a form (FrmA) with a subform (SubFrmB) embedded in it.
SubFrmB also has a subform embedded in it (SubFrmC) The form's
recordsource is based on a table (TblA). SubFrmB's
recordsource is also based on a table (TblB). SubFrmC's
recordsource is also based on a table (TblC).

There is a one-to-many relationship between TblA (one) and
TblB (many). There is a also a one-to-many relationship
between TblB (one) and TblC(many). The forms are similarly
linked.

I want to be able to copy the recordset in SubFrmB - along
with its many records in SubFrmC - so I can then insert that
recordset as a new record in FrmA.


What you want to do is only possible if the three tables have
identical structures. You are seesntially talking that you want to
copy a row from table B into Table A and the row(s) from Table C
into table B. If your tables are identical, they should be merged
into 1. then you don't need to copy anything, just find the row in
form B and give instruction to form A to move to that row.

I considered using the RecordsetClone function for this. But
since the RecordsetClone property setting makes a copy of the
underlying table specified by the form's RecordSource
property, that won't work for me since there are three tables
in play here.

Any and all suggestions on how I could possibly accomplish
this would be GREATLY appreciated!


I think we need to understand the purpose of your forms so that we
can find an alternative solution.

Bob Q.

Thanks!!!

Tom

Nov 12 '05 #3
"Tlm" <t.*******@comc ast.net> wrote in
news:Xursb.1818 03$Fm2.164376@a ttbi_s04:
Bob, Thank you for your posting. The situation I'm facing with
this issue is this: This database tracts publications. The main form (FrmA -
TablA) maintains data regarding an overall ORDER to be sent to
a printer; order #, name, date, etc. The subform in the order
form (SubFrmB - TblB) maintains data regarding particular JOBS
in the order; colors to be used, paper weight, etc. (there are
often 20 or more jobs to an order). The subform in the jobs
subform maintains data regarding the DISTRIBUTION of the jobs;
how many go here, how many go there, etc. (there are often 20
or more separate distribution destinations for each job).

Many jobs are often very similar, but have one or two
different values in some fields. The user wants to be able to
'copy' a job (along with its distribution data) and 'paste' it
in a new order - then modify as required. The intent is to
save the user all that redundant data entry, and potential
type-Os, (there are over 50 fields on the job - SubFrmB - form
alone). So, it's not exactly redundant data. But nearly.

I take your point about there being actually THREE recordsets
here. And your recommendation that I use three separate
append queries sounds logical. But how?
So you are not moving the recordset of table B into table A, but
making a copy in table B.

How do you compose order#, job# and Distribution#? and what is the
nature of the relations between tables. Does the distribution table
have the job # as a foreign key? To tell you specifically how to
clone the records, we need to know this,.

You will definitely need a good bit of code here to do what you
want.

I'd plan it out this way.

Create a new Order in table A. this gives you a new order number.
Have a "clone order" button on the form that asks for a clonefrom#,
copies all the records for table B having order# = clonefrom#, but
replacing order# with cloneto#.

Then the code selects all the records in table C that have a Job#
record that has the cloneto# as its order#. Now you have to insert
the records into Table C again, but update the job#s in tables B
and C to reflect the new job#s.

Thank you again!!!

Tom



"Bob Quintal" <bq******@gener ation.net> wrote in message
news:b1******** *************** *******@news.te ranews.com...
"Tlm" <t.*******@comc ast.net> wrote in
news:hvdsb.1747 80$Fm2.153056@a ttbi_s04:
> Hello All,
>
> I have a form (FrmA) with a subform (SubFrmB) embedded in
> it. SubFrmB also has a subform embedded in it (SubFrmC) The
> form's recordsource is based on a table (TblA). SubFrmB's
> recordsource is also based on a table (TblB). SubFrmC's
> recordsource is also based on a table (TblC).
>
>
>
> There is a one-to-many relationship between TblA (one) and
> TblB (many). There is a also a one-to-many relationship
> between TblB (one) and TblC(many). The forms are similarly
> linked.
>
>
>
> I want to be able to copy the recordset in SubFrmB - along
> with its many records in SubFrmC - so I can then insert
> that recordset as a new record in FrmA.


What you want to do is only possible if the three tables have
identical structures. You are seesntially talking that you
want to copy a row from table B into Table A and the row(s)
from Table C into table B. If your tables are identical, they
should be merged into 1. then you don't need to copy
anything, just find the row in form B and give instruction to
form A to move to that row.
>
>
>
> I considered using the RecordsetClone function for this.
> But since the RecordsetClone property setting makes a copy
> of the underlying table specified by the form's
> RecordSource property, that won't work for me since there
> are three tables in play here.
>
>
>
> Any and all suggestions on how I could possibly accomplish
> this would be GREATLY appreciated!


I think we need to understand the purpose of your forms so
that we can find an alternative solution.

Bob Q.
>
>
>
> Thanks!!!
>
>
>
> Tom
>
>
>



Nov 12 '05 #4

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

Similar topics

6
1781
by: Geir Baardsen | last post by:
Hi! This is a routine for copying a recordset into a new order. It has worked fine under Win98. However, my client has changed to Win XP, and suddenly it doesn't work anymore. I keep getting the following error message: Object is not in collection. So I do a very thorough check and doublecheck of fieldnames from underlying table,...
1
1753
by: Geir Baardsen | last post by:
Hi! As you can see I have worked with my code and done some changes. Now the code will execute, because of this, and because I took away some code in the OnCurrent event that was probably causing a clash. It does in fact copy the new Invoice number and the data from tblOrderDetails, but still missing is the CustID-field, that it refuses to...
3
3201
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data. The PK (ProductID) for each record on the form is an AUTONUMBER. This form also has a sub-form, linked via ProductID. The subform also
2
2857
by: josephm | last post by:
Hello Group: My first post on the group.Hope I get a response. I have a modest Fire Insurance ACCES Db.Thanks to this group - for the code. A "wanna be programmer"... "LEARNS" The code here-under (from the Archive) duplicates the EXPIRING records but affords the USER to give ONLY A NEW POLICY NO (NewKey),should a client opt to renew upon...
7
4982
by: Eric | last post by:
I want to open up 2 record sets. Then, copy everything from one record set to another (excluding a few fields). Is this possible? I need to exclude my primary key, and fields starting with "TMP_". I'm trying this, but it's saying ADODB.Recordset error '800a0c93' Operation is not allowed in this context.
4
4963
by: Jim Devenish | last post by:
I wish to copy a table on a SQL Server backend to a table on an Access (.mdb) front end in the simplest way. I have the following to get the recordset but am seeking something easier. Dim theConnectionString theConnectionString = "Driver=SQL Server; Server=Server;Database=myData;Trusted_Connection=Yes"
2
9254
by: mustang123 | last post by:
Hi, I get data from sybase server using ADO Connection and disconnected recordset in my access Database. Now I have a disconnected recordset. I want to insert the contents of this recordset into a Access table. I can loop through the recordset and insert record by record. But I want to do a bulk insert/Update assuming the columns are the...
3
9228
by: Richnep | last post by:
Hi all, I have tabbed subforms where I need to copy one field value from one subform over to another subform. Although I can run an update query to accomplish this I would like to do it through VBA. sub tables relationships are 1:N with the main table. So the recods display like this in the subform:
0
1407
by: Neelesh2007 | last post by:
Hi all, I have project with VB6.0 and Access-2003. I have datagrid and ADODC as datasource to retrieve records from database. To export the data of datagrid to Excel I am using Copy From Recordset Method. It works fine but when I apply Filter on Adodc Recordset, The Copy From Recordset Method Export All Records in Excel File. I want to export ony...
0
7420
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7680
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7446
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7778
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6003
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4966
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3459
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1033
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
731
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.