G
Guest
I have a database that is used to track production on several thousand
records in a second database. The production database is all I am dealing
with here so really you dont have to worry about the second. Anyhow, every
month each office has to supply metrics on how much production was conducted
that month, whether offices are behind at or ahead of schedule and so forth.
Creating these slides (for powerpoint) is time consuming and is prone to lots
of error.
To remedy this, I am creating this database that when the Production Slide
creation procedure is executed it queries each of three tables that hold the
relevant data and inputs a record count of the records that match the query.
When this first started it worked pretty good. I only have a few hundred
records and it took about 2 minutes to do all of the queries (I worked it out
and it is about 1400 queries [12 months x 3 record types x 8 regions x 4 or 5
production types]). After I added the rest of the offices records to the
tables to be queried, it takes about 45 minutes to run the whole procedure.
To remedy this, I am reworking the procedure so that it creates 36 record
sets (12 months x 3 record types). The problem is this:
Is there a way to refer to the recordsets via string variables used in For
Loops? I know that there is not a recordset collection, but I will allude to
one for the purposes of this example...
i.e.
Dim MonthArray(11) as String 'lets assume I fill this array with month names
Dim RecTypeArray(2) as String 'lets assume I fill this array with record
Type names
Dim monthCounter as Integer
Dim RecTypeCounter as Integer
For MonthCounter = 0 to 12
For RecTypeCounter = 0 to 2
RecordSets(MonthArray(MonthCounter) &
RecTypeArray(RecTypeCounter).Open conn, Lock Type, etc.
Next RecTypeCounter
Next MonthCounter
I can handle opening each recordset "manually", but later on in a different
process, I will need the proper recordset queried based on which month and
which record type is being currently measured. Any thoughts?
And please let me know if I made this too confusing, I sometimes have a
difficult time putting my thoughts into words.
Cory
records in a second database. The production database is all I am dealing
with here so really you dont have to worry about the second. Anyhow, every
month each office has to supply metrics on how much production was conducted
that month, whether offices are behind at or ahead of schedule and so forth.
Creating these slides (for powerpoint) is time consuming and is prone to lots
of error.
To remedy this, I am creating this database that when the Production Slide
creation procedure is executed it queries each of three tables that hold the
relevant data and inputs a record count of the records that match the query.
When this first started it worked pretty good. I only have a few hundred
records and it took about 2 minutes to do all of the queries (I worked it out
and it is about 1400 queries [12 months x 3 record types x 8 regions x 4 or 5
production types]). After I added the rest of the offices records to the
tables to be queried, it takes about 45 minutes to run the whole procedure.
To remedy this, I am reworking the procedure so that it creates 36 record
sets (12 months x 3 record types). The problem is this:
Is there a way to refer to the recordsets via string variables used in For
Loops? I know that there is not a recordset collection, but I will allude to
one for the purposes of this example...
i.e.
Dim MonthArray(11) as String 'lets assume I fill this array with month names
Dim RecTypeArray(2) as String 'lets assume I fill this array with record
Type names
Dim monthCounter as Integer
Dim RecTypeCounter as Integer
For MonthCounter = 0 to 12
For RecTypeCounter = 0 to 2
RecordSets(MonthArray(MonthCounter) &
RecTypeArray(RecTypeCounter).Open conn, Lock Type, etc.
Next RecTypeCounter
Next MonthCounter
I can handle opening each recordset "manually", but later on in a different
process, I will need the proper recordset queried based on which month and
which record type is being currently measured. Any thoughts?
And please let me know if I made this too confusing, I sometimes have a
difficult time putting my thoughts into words.
Cory