Question Locked

Simple...or what should be simple... Access 2007 question

0 helpful
8 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a field in a table that contains a number or days (examp 100) I need to add a field to a report or right back into the table that calculates the date 100 days ago. Why is this so hard for Access?

8 replies

by Former member

Clarifications

by maevinn

Now()-Field1 works fine. It won't happen in a table view, because that's recursive. You're asking it to tell you a date that's XX days ago, when XX hasn't been identified.

Setting it up in a report, use the formula above (preferably with some formatting) and it will be just fine. Or modify the data entry form to perform the calculation and update a field in the table, unless you need the value to always be XX from NOW(), rather than XX from the date the record was entered.

by Former member

=DateAdd("d",-[Age 1],[Date])

I used this to get the date to count back whatever the number of days were in the Field (Age 1). It works. Thing is, I can't count back from the current date, I have to count back from the date the data was collected and put in Age 1 (via pocket pc).

by tony hopkinson

e.g
Update MyTable
Set [DateSomeDaysAgo] = DateSubtract("d",[Age1],[Date])
Where [DateSomeDaysAgo] is null

by maevinn

Use the Now() function instead of the Date field. That will give you the current date.

by Former member

I just read my earlier post, I should have said - I must use the date that came in from the pda, not the current date. So what I did works. I'd rather have it be in the table. How is that possible?

by maevinn

Create an update query that runs on close for the data entry form.

This discussion is closed to new replies.