Check this link, which uses the dynamic recordset.
Okay, here you have a situation of getting the data from the same table
with all calculations on one or more fields (customed).
Here if it was SQL2000, I have guided you to use StoredProcedures to get
the data as you needed. In Access you cannot write SP only queries of
DDL and DML.
So all you have to do is, create a dynamic recordset, create all your
fields as needed, open the tblRepairs table with another recordset
with all proper SQL statement with where conditions, Make sure that
recordset holds the data which needs to be calculated on date diff,
then using DateDiff functions of VBA calculate the date between
two dates, and insert this value into the dyna recordset field.
Loop the main recordset of tblRepairs upto EOF and keep inserting
the data with all calculated values into this dyna recordset.
Finally you can bind this Recordset to the datagrid.
NOTE: above will require the ADO2.0 not DAO.
So, if you feel and want to stick on DAO itsself, then i have
another way to approach this situation.
Just create another table with all fields you needed on output.
open recordset, get the value from the table, use them for your
date calcultions. take all calculted data in respective variables.
Keep inserting them into the table until you reach EOF.
finally, you bind that table to the grid.
(Here you have to design a static table where design is not
changed every now and then, only the data in table will
deleted and new data is inserted every time you call this
NOTE: these are the low level ideas to get the work done.
Open the recordset like Select A,B,C, datediff(e - f) as 'days' from table
name where ... alll conditions follow.
There are some other ways too, but our limitations is on T-SQL of MS-ACCESS.
So we have to program is such a way that my keeping them in mind.
well, i guess, its not a easy job to understand such process too soon.
needs some time to get the best solution to fit in.
anyway, just think about it and let me.
Hope this helps.