Mass data saving to tables

L

Lester Lane

I have many screens now that have subforms with many records that I
edit and then "process". In addition I have code that takes a
parameter and "produces" many records. At the moment I have
centralised code that performs these various functions (for ease of
editing but it is not Object Orientated) BUT it only copes with one
record at a time. Can I pass the whole recordset in one go?

Say I have a client who sells a stock, he will be one in many who may
sell on that day, so there is a recordset of this data with many
records. As part of the processing I will be adding to CGT records,
cashbook etc, for each client. So the procedure that deals with say,
adding to cashbook is called each time for each client within Loop or
While statements. There must be a smarter way as each time these
central procedures are called they setup recordsets (append only
normally) add data, and then close them, pointers most welcome. (I'm
using Access 2003, one file for tables and one for the queries/forms/
reports/code etc. Thanks
 
L

Lester Lane

I have many screens now that have subforms with many records that I
edit and then "process". In addition I have code that takes a
parameter and "produces" many records.  At the moment I have
centralised code that performs these various functions (for ease of
editing but it is not Object Orientated) BUT it only copes with one
record at a time. Can I pass the whole recordset in one go?

Say I have a client who sells a stock, he will be one in many who may
sell on that day, so there is a recordset of this data with many
records. As part of the processing I will be adding to CGT records,
cashbook etc, for each client.  So the procedure that deals with say,
adding to cashbook is called each time for each client within Loop or
While statements.  There must be a smarter way as each time these
central procedures are called they setup recordsets (append only
normally) add data, and then close them, pointers most welcome. (I'm
using Access 2003, one file for tables and one for the queries/forms/
reports/code etc.  Thanks

Forgot to say I'm using DAO 3.6
 
L

Lester Lane

Forgot to say I'm using DAO 3.6

Was my question so boring or simple?! I've started to answer this
myself, I think. Would I be right in thinking that you can actually
pass a recordset as a parameter to a subroutine? If so would I build
the data in my para recordset (using more recordsets and processes in
loop/while statements) and then at the end pass it to the subroutine
that would then open its own append recordset and loop round
until .EOF to save each record? Would this be significantly faster
than saving one record at a time? Maybe I should try timestamping the
start and end of the whole process. Hints and tips most welcome.
 
L

Lester Lane

Was my question so boring or simple?!  I've started to answer this
myself, I think.  Would I be right in thinking that you can actually
pass a recordset as a parameter to a subroutine?  If so would I build
the data in my para recordset (using more recordsets and processes in
loop/while statements) and then at the end pass it to the subroutine
that would then open its own append recordset and loop round
until .EOF to save each record?  Would this be significantly faster
than saving one record at a time?  Maybe I should try timestamping the
start and end of the whole process.  Hints and tips most welcome.

This is insane! The recordset that is passed to the subroutine - how
is it created? I always thought it had to link to a query or table
(both real live data). Can you have a recordset that is purely in
memory when you Update and not linked to a real table? Someone please
help...
 
L

Lester Lane

This is insane!  The recordset that is passed to the subroutine - how
is it created? I always thought it had to link to a query or table
(both real live data).  Can you have a recordset that is purely in
memory when you Update and not linked to a real table?  Someone please
help...

I'll just carry on talking to myself! The trouble with VB is that
there are so many ways to do the same thing. What about defining a
Type and then making an array using the Type? Can this be passed like
a recordset? or should I make it Global so the routine can refer to
it? Is anyone there!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top