tractorvix
Technical User
Ok, so I appreciate that my header isn't that great, but what I'm trying to achieve is quite difficult to explain succinctly!
I have a table called tbl-balances, which has it's first column (Jan 08) populated. I then need to use this number to calculate the next column worth of data (Feb 08), which I've done as a make table query with the following:
SELECT [qry-VarFlowDetail - 3].ProdXrefID, [tbl-Balances]![Jan 08]+[qry-VarFlowDetail - 3]![Feb 08]+[qry-IntCred - 4]![Jan 08] AS Feb INTO [tbl-hold]
FROM [tbl-Balances] INNER JOIN ([qry-VarFlowDetail - 3] INNER JOIN [qry-IntCred - 4] ON [qry-VarFlowDetail - 3].ProdXrefID = [qry-IntCred - 4].ProdXrefID) ON [tbl-Balances].ProdXrefID = [qry-IntCred - 4].ProdXrefID;
This tbl-hold is then used to populate the next column in the tbl-balances:
UPDATE [tbl-Balances] INNER JOIN [tbl-hold] ON [tbl-Balances].ProdXrefID = [tbl-hold].ProdXrefID SET [tbl-Balances].[Feb 08] = [tbl-hold]![Feb];
I then need to use this data to calculate the next column (Mar 08), again hold the data in tbl-hold, then update the next column etc.
I'm sure there must be a way of looping through this code without me having to create lots of make table and update table queries, but I've not really used the SQL side of things before and certainly never created a module.
Any help would be much appreciated.
Thanks
Vicky
I have a table called tbl-balances, which has it's first column (Jan 08) populated. I then need to use this number to calculate the next column worth of data (Feb 08), which I've done as a make table query with the following:
SELECT [qry-VarFlowDetail - 3].ProdXrefID, [tbl-Balances]![Jan 08]+[qry-VarFlowDetail - 3]![Feb 08]+[qry-IntCred - 4]![Jan 08] AS Feb INTO [tbl-hold]
FROM [tbl-Balances] INNER JOIN ([qry-VarFlowDetail - 3] INNER JOIN [qry-IntCred - 4] ON [qry-VarFlowDetail - 3].ProdXrefID = [qry-IntCred - 4].ProdXrefID) ON [tbl-Balances].ProdXrefID = [qry-IntCred - 4].ProdXrefID;
This tbl-hold is then used to populate the next column in the tbl-balances:
UPDATE [tbl-Balances] INNER JOIN [tbl-hold] ON [tbl-Balances].ProdXrefID = [tbl-hold].ProdXrefID SET [tbl-Balances].[Feb 08] = [tbl-hold]![Feb];
I then need to use this data to calculate the next column (Mar 08), again hold the data in tbl-hold, then update the next column etc.
I'm sure there must be a way of looping through this code without me having to create lots of make table and update table queries, but I've not really used the SQL side of things before and certainly never created a module.
Any help would be much appreciated.
Thanks
Vicky