Can I enter a field in a form that everytime the form opens up it inputs the current date. I'm trying to count the number of months a document has been expired. In one field I entered the expiration date and and in another I want "today's" date to populate so I can visually see how many months it's been expired. Also, can I create an expression in another field to count the number of months from the time the document expired to current date? Then when the document comes in and is 'Locked' I can just have a total number of months it was expired. Sorry! Kind of confusing.
Kris
Reply from Richard Rost:
Kristine, I covered the DATE function in Level 3. Just set that as the DEFAULT VALUE for your field (either in the form or the table itself) to get the current date.
Now counting the number of months is a little more tricky. If you want just a "good enough" value then you can simply subtract the number of days and divide by 30. Like this:
=(Date()-MyDateField)/30
That will give you ROUGHLY the right number of months. If you want a more exact value, you'll have to use the DATEDIFF function, which is a little more advanced.
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Beginner 4.