Good morning people,
I wish to use VBA to open an Access Query, loop through each record, and then based on the result of a certain field create calculations in which i wish to place as a new record in a new table.
If anyone out there can give be the basic code that will : -
Collect the Data,
Loop through data
create a new table
post variable to the new table (as records).
...
User Profile
Collapse
-
Loop through a data table and then update another table
-
Excellent!!
Great stuff, now I have all I need to start my Project!
Thank you very much. -
I have removed the nts references so now it looks like: -
Function Set_last(Values , criterias)
last_criteria = criterias
last_used = Values
Set_last = last_used
End Function
the code runs okay but my resulting table is duplicating the running sum?
i.e.
id totals Run_sum groups
1 0.2 0.4 group1 (added 0.4 instead of 0.2)
2 0.2 0.8 group1 (added 0.4...Leave a comment:
-
Thanks for the script, however I am getting a sub or function not defined.. with the nts highlighted??Leave a comment:
-
I will be using the results as a transfer to MS Excel (the only reason I am using Access is because of the amount of rows required (over 65000 records). I will be happy to use any method avaliable.Leave a comment:
-
I used a sql query to create an alias and then compared ID with ID : -
SELECT tbl_Alias.group s, tbl_Alias.id AS Expr1, (SELECT Sum([table3].[totals]) AS Total
FROM [table3]
WHERE ((([table3].[ID])<=[tbl_alias].[ID]));) AS [Running Total], tbl_Alias.total s
FROM table3 AS tbl_Alias, Table3
GROUP BY tbl_Alias.group s, tbl_Alias.id, tbl_Alias.total s;
This wirks by creating a running total based...Leave a comment:
-
Thanks for that, I think I understand what you mean!!
But if I sum by group and then run a query on the results, won't that just give me the running total of the groups?
I am looking to list all records by group with all the fields in each group showing a running total. After I have achieved that I only want to see records in ech group that reach a certain value.
Thanks againLeave a comment:
-
Create a Query that provides a running total but grouped?
I need to create a query that produces running totals for every group within my table for example i wish to see: -
Group A
[running total] 1
[running total] 5
[running total] 9
[running total] 15
Group B
[running total] 1
[running total] 2
[running total] 20
etc..
I have worked out how to produce a running total but this...
No activity results to display
Show More
Leave a comment: