Benjaminvh
Registered User.
- Local time
- Today, 02:02
- Joined
- Mar 11, 2009
- Messages
- 17
Hi
I have written VBA code in excel that takes an existing access table (1), does calculations and pastes the 'answers' in a different table (2). Through this process, for each record in the first table, about 20 are created in the second. Access cant handle all the records in table2, so what I'd like to do, every now and again (after, say 50000 table1 records/1mil table2 records), is group by a few variables, and sum the calculated column. This will greatly reduce the number of records to something manageable.
I will make an empty table with the required columns, and then group and append each time until EOF (table1). How do I do this using VBA in excel? The SQL text I have is:
INSERT INTO table2 ( PRODUCT_CODE, IRP_MKR, PRM_INC_RATE, SUM_ASSURED_BAND, DURATION, SumOfEXPOSURE )
SELECT table1.PRODUCT_CODE, table1.IRP_MKR, table1.PRM_INC_RATE, table1.SUM_ASSURED_BAND, table1.DURATION, Sum(table1.EXPOSURE) AS SumOfEXPOSURE
FROM table1
GROUP BY table1.PRODUCT_CODE, table1.IRP_MKR, table1.PRM_INC_RATE, table1.SUM_ASSURED_BAND, table1.DURATION;
Any assistance would be greatly appreciated!!!
I have written VBA code in excel that takes an existing access table (1), does calculations and pastes the 'answers' in a different table (2). Through this process, for each record in the first table, about 20 are created in the second. Access cant handle all the records in table2, so what I'd like to do, every now and again (after, say 50000 table1 records/1mil table2 records), is group by a few variables, and sum the calculated column. This will greatly reduce the number of records to something manageable.
I will make an empty table with the required columns, and then group and append each time until EOF (table1). How do I do this using VBA in excel? The SQL text I have is:
INSERT INTO table2 ( PRODUCT_CODE, IRP_MKR, PRM_INC_RATE, SUM_ASSURED_BAND, DURATION, SumOfEXPOSURE )
SELECT table1.PRODUCT_CODE, table1.IRP_MKR, table1.PRM_INC_RATE, table1.SUM_ASSURED_BAND, table1.DURATION, Sum(table1.EXPOSURE) AS SumOfEXPOSURE
FROM table1
GROUP BY table1.PRODUCT_CODE, table1.IRP_MKR, table1.PRM_INC_RATE, table1.SUM_ASSURED_BAND, table1.DURATION;
Any assistance would be greatly appreciated!!!