General discussion

Locked

DateDiff, MS Access 2000

By PurcellJ ·
Can anyone explain how DateDiff is used. I developed a form from my table. I have two date/time fields - "DEPART" and "RETURN". I created another field called "DAYS DEPLOYED". In the "DAYS DEPLOYED" field's properties, I inserted the following: =DateDiff("d",[DEPART],[RETURN]) When I fill out the form, the "DAYS DEPLOYED" field is populated as expected; however, the results do not appear in the table, which in turn generates a false Report. Can anyone shed any light on this.

Thanks
Jack Purcell

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by a.barnes In reply to DateDiff, MS Access 2000

Jack,

If you're using a calculated field, you'll need to write some code to take the data from the field and enter into the current record. What if you duplicated that function in the report, or in the query the report is based on instead?

HTH

Collapse -

by John Gordon In reply to DateDiff, MS Access 2000

Hi Jack,

By inserting '=DateDiff("d",[DEPART],[RETURN])' you are telling the form field to get its value from that formula rather from the table and therefore effectively losing any relationship between that form field and the table so any changes to the form field will not be reflected in the table.

If you really want to store the value in the table, instead of re-calculating it on any reports or other forms, you could create a macro or bit of VB code to update the table with the contents of the form field when you move to the next record, save the record, close the form, etc.

John

Back to Software Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums