gareth88
06-30-2009, 09:49 AM
I am working on a database for an operating room. In one of the fields I need to calculate the duration of the operation that has taken place. So I have 3 fields, Start time, End time and Duration. What formula do I enter in the Duration field, to subtract the Start time from the End time? Also, where would I enter it? I feel as if it's something very small, but everything I have tried so far, hasn't worked.
Scooterbug
06-30-2009, 10:11 AM
Calculations should not be stored in a table. You can compute them when you need them.
You can use the DateDiff function to calculate the difference. Check out the help file for details on how it's used.
I will throw my agreement in with Scooterbug. If you have two pieces of data then you have sufficient info to calculate at runtime what you need. The other data shouldn't be stored because if someone changes one of the other pieces of data, then the calculated value would no longer be accurate. That is one major reason why you don't normally store calculated data as it has Referential Integrity as a goal as well. If Access had triggers, like SQL Server