On May 21, 7:57 am, "sandiptay...@gmail.com" <sandiptay...@gmail.com>
wrote:
Hi,
I have a query that generates a table with following columns follows:
Aaa Aa1 Aa2 Aa3 Baa1 Baa2 Baa3 Ba1 Ba2 Ba3 B1 B2 B3 CCaa D
This is generated by an insert into statement. I then modify the table
to add an autoincrement primary key (to preserve row order).
What I want is to be able to loop my code, ie each 'run' produces one
table of the above format. I want another table to hold the sum of
tables. e.g.
Say I had
Cols: Item 1 / Item 2
11 1
4 10
and:
Cols: Item 1 / Item 2
19 12
14 8
I want another table to give me
Cols: Item 1 / Item 2
30 13
18 18
and when i run the code again and say the following gets produced:
Cols: Item 1 / Item 2
1 1
1 1
I want to update my summation table to reflect
Cols: Item 1 / Item 2
31 14
19 19
Any thoughts on how this can be done ?
Thanks !
First tables do not have columns they have fields.
Second tables do not have rows they have recrods.
Third, autonumber will not NECESSARILY match any given 'order'.
Autonumber is NOT intended to be used as a field that has any meaning
what-so-ever- to the data within the table. It is merely a unique
numebr assigned to each record. Using increment rather than random
autonumbers does not change this at all. Just because a given record
has the value "6" in the autonumber field does NOT mean that it is the
6th record. As such it is (IMHO) always better to use random
autonumbers so asto not even give the appearance that the numbers mean
anything.
To do what I THINK you are asking you should first have ADD TWO
fields. One a field that YOU populate with unique data (such as a
item tag number, employee id, etc). The other a field with called
RunDate or something silimar that hold the date a given run was made.
Then modify yoru 'code' so that it appends data to the table on each
run rather than creating a new table each time. After that you can
run a simple summation query to get the desired output.
If you continue in the manner you are on, you will need to run
multiple queries to ensure that unmatched records are summed etc.