ExcelKid1081
asked on
DAO Recordset Calculate Difference between Columns in Two Tables
Hello-
I have a question regarding how to loop through one recordset and find the difference between a second recordset. What I have is two tables, with a one-to-many relationship. Both Tables have the exact same structure (ie. field names, # fields). I would like to loop through each record in the Many table and calculate the difference for for each field between the two tables. This could be done in a Select Query however, I have +30 fields and I am thinking there must be a way to do this programatically.
Thanks!
EK
I have a question regarding how to loop through one recordset and find the difference between a second recordset. What I have is two tables, with a one-to-many relationship. Both Tables have the exact same structure (ie. field names, # fields). I would like to loop through each record in the Many table and calculate the difference for for each field between the two tables. This could be done in a Select Query however, I have +30 fields and I am thinking there must be a way to do this programatically.
Thanks!
EK
ASKER
I see where you are going with this code but its not quite what I am looking for. Perhaps my explanation of my data was a little off so here is another shot:
I have two tables with same field number of fields. What I would like to do is subtract the value for each field between them. For example, TableOne.Field(1)-TableTwo .Field(1).
However, since there are numerous records in each table I would like to be able to set the filter on the recordset for each so that the appropriate records are being selected (I already have code for this).
What I really need help with is how do I set up a loop so that after my filters are applied I can get the difference between TableOne.Field(1)-TableTwo .Field(1), TableOne.Field(2)-TableTwo .Field(2), TableOne.Field(3)-TableTwo .Field(3) and so on...? Hope that makes sense!
Thanks!
EK
I have two tables with same field number of fields. What I would like to do is subtract the value for each field between them. For example, TableOne.Field(1)-TableTwo
However, since there are numerous records in each table I would like to be able to set the filter on the recordset for each so that the appropriate records are being selected (I already have code for this).
What I really need help with is how do I set up a loop so that after my filters are applied I can get the difference between TableOne.Field(1)-TableTwo
Thanks!
EK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I decided to go a different route with this one. Thanks for your reply though
Open in new window