473,505 Members | 14,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Append records from a set to another table.

I'm trying to duplicate the functionality of a routine that I'm
updating into a new database.

The old application assumes you have a filtered set of records behind a
form. The form is open, with the filtered recordset. Next it copies a
clone of the form's recordset into a table with one field (Customer) so
it can use this as a join table to print from.

I was able to re-write the loop and get it to work, but it sure seems
like it'd be more quickly done with a quick sql statement. Here is the
loopy, time consuming code I re-generated.

Set cRst = Forms![1b customer definition].RecordsetClone
Set pRst = db.OpenRecordset("3 print customers")

cRst.MoveFirst

Do While Not cRst.EOF
pRst.AddNew
pRst!customer = cRst!cust_code
pRst.Update
cRst.MoveNext
Loop

Someone tell me there is a faster, easier way to append the cloned
recordset into the target recordset. This seems so brute force. It
pained me to write the do loop!

Thanks in advance.

-BrianDP

Nov 13 '05 #1
1 2393
BrianDP wrote:
I'm trying to duplicate the functionality of a routine that I'm
updating into a new database.

The old application assumes you have a filtered set of records behind a
form. The form is open, with the filtered recordset. Next it copies a
clone of the form's recordset into a table with one field (Customer) so
it can use this as a join table to print from.

I was able to re-write the loop and get it to work, but it sure seems
like it'd be more quickly done with a quick sql statement. Here is the
loopy, time consuming code I re-generated.

Set cRst = Forms![1b customer definition].RecordsetClone
Set pRst = db.OpenRecordset("3 print customers")

cRst.MoveFirst

Do While Not cRst.EOF
pRst.AddNew
pRst!customer = cRst!cust_code
pRst.Update
cRst.MoveNext
Loop

Someone tell me there is a faster, easier way to append the cloned
recordset into the target recordset. This seems so brute force. It
pained me to write the do loop!

Thanks in advance.

-BrianDP


Well, chances are you should be able to build the right WHERE clause
information from the .Filter property. The fastest way is to just do
something like this:

DoCmd.RunSQL "insert into NewTable (field, ..., fieldN) " & _
"select * from MyTable where ...filterinfo"

Nov 13 '05 #2

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

Similar topics

3
23929
by: Jonathan Buckland | last post by:
Can someone give me an example how to append data without having to load the complete XML file. Is this possible? Jonathan
2
5225
by: John | last post by:
Hi - I am trying to perform a simple append query, with no luck. I have a table (MktPrices) that has the following fields: BondID, PriceDate, Price. The objective is to allow the user to input a...
2
5772
by: JMCN | last post by:
hi i have a general question regarding append queries in access 97. each week i need to update my table(tblonlinereg) with new or modified records. firstly, i import the text file into my...
1
2470
by: David Barger | last post by:
Greetings, It appears that an Append Query I run in Access XP is randomly failing to append a field. I have payroll data being entered into a payroll database. This data is exported daily to...
2
3373
by: Steve B | last post by:
I am trying to design a Call Log Detail form that will allow users, in a multi-user environment, to select various data/records, not necessarily in sequential order, from a subform that will, when...
2
3547
by: Mark | last post by:
I have a FE/BD 2002 DB on a XP pro platform. I know this is ugly but it works for me...... A text file is produced from our Oracle WMS. (Average 20k records) A command button deletes all records...
5
5345
by: Michael C via AccessMonster.com | last post by:
Hello, I have a table that I am appending 3 seperate tables into. My main problem is that each time I append the data, it simply adds to the data already there. That might sound ok, except that...
22
18764
by: RayPower | last post by:
I'm having problem with using DAO recordset to append record into a table and subsequent code to update other tables in a transaction. The MDB is Access 2000 with the latest service pack of JET 4....
4
7370
by: MN | last post by:
I have to import a tab-delimited text file daily into Access through a macro. All of the data needs to be added to an existing table. Some of the data already exists but may be updated by the...
3
8022
by: wvmbark | last post by:
First time poster... I just found this forum and it appears there's plenty of people here that could make short work of problem that's been driving me absolutely bonkers for months. Every day we...
0
7216
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
7303
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,...
1
7018
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
7471
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
5613
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,...
0
4699
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
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
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
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.