Hi all,
Question: is it possible to call a VBA function which loops through the records from within the same query?
I have a simple parent-child table relationship where I’ve created a VBA function (e.g. SomeFunction) to loop through the child table to:
1. Identify child values associated with the parent foreign key (FK)
2. Assign them to variables within the function
3. Perform calculation on the variable
Then it executes another loop iteration to the next FK.
Something like….
Child PK ParentFK ChildField
1 2 Value1
2 2 Value2
3 3 Value1
4 3 Value2
Loop values are assigned variables (e.g. Var A = Value 1, Var B = Value 2), then the function performs a calculation such as:
SomeFunction = A + B
Then the loop starts a new iteration.
SomeFunction() is called from a query column. But….
The query only returns the last calculated value since the values are overwritten as it completes each loop iteration.
Question: Is it possible to assign each loop iteration’s value to a row in the query associated with the FK?
Many thanks for your input.
Question: is it possible to call a VBA function which loops through the records from within the same query?
I have a simple parent-child table relationship where I’ve created a VBA function (e.g. SomeFunction) to loop through the child table to:
1. Identify child values associated with the parent foreign key (FK)
2. Assign them to variables within the function
3. Perform calculation on the variable
Then it executes another loop iteration to the next FK.
Something like….
Child PK ParentFK ChildField
1 2 Value1
2 2 Value2
3 3 Value1
4 3 Value2
Loop values are assigned variables (e.g. Var A = Value 1, Var B = Value 2), then the function performs a calculation such as:
SomeFunction = A + B
Then the loop starts a new iteration.
SomeFunction() is called from a query column. But….
The query only returns the last calculated value since the values are overwritten as it completes each loop iteration.
Question: Is it possible to assign each loop iteration’s value to a row in the query associated with the FK?
Many thanks for your input.