Date Calculations

suemack

New member
Local time
Today, 11:59
Joined
Apr 7, 2003
Messages
9
I would like to subtract two date fields and use the difference for the value of another field in my table...
Example: I have one table with 3 different fields: DOD, DOA, and LOS. I want to subtract DOA from DOD and use the difference to populate the LOS field...
I have a form where the user enters the DOD and the DOA... then they click a button that takes them to another form that has the LOS text box whose control source is LOS... I want the difference to populate the LOS text box whose control source is the LOS field in my table...
This seems like such an easy thing but I can't seem to figure out where the DOD-DOA goes...
 
Since Los is calculated you shouldn't store it at all, the value can be returned in a query/calculated control.
Look up the DateDiff function
 
normally I wouldn't store LOS but in this case I truely need to. I need to store the values of these three fields in one table. once they are in table format, I send the data off to another organization..
 
If you send the data off via exporting to a spreadsheet or file, export a query with the computed field in it. Don't store the computed value in a table.
 
Here you go. The texts might be wrong. but his is how you use datediff().

You should be able to adapt it to yours
 

Attachments

Users who are viewing this thread

Back
Top Bottom