subtracting dates

  • Thread starter Thread starter culbertson
  • Start date Start date
C

culbertson

I volunteer for a community service organization.

I have a database that records the date began. I need to
generate a report that lists time on the program.

How can I subtract dates and come up with years.

I have one field with DateBegan and one I created in the
query CurrentDate:Now()

I tried the following in the querry:
TimeOnProg: ([CurrentDate]-[DateBegan])/12

but I do not get the answers I need

what am i doing wrong?
 
How can I subtract dates and come up with years.
I have one field with DateBegan and one I created in the
query CurrentDate:Now()

I tried the following in the querry:
TimeOnProg: ([CurrentDate]-[DateBegan])/12

See the following page at Allen Browne's web site:

Age() Function
http://members.iinet.net.au/~allenbrowne/func-08.html

Copy the function provided to a standard module (global module, not one behind a
form or report) and use as follows:

TimeOnProg: Age([DateBegan], Date())
 
I'm afraid that didn't help me much. I am not using
modules, i am only using it in a querry.

I am a beginner but I learn quick.

it wouldn't accept TimeOnProg1: Age([DateBegan],Date())

it didn't know what Age was.

I went to the web site and I don't want to use any VB


-----Original Message-----
How can I subtract dates and come up with years.

I have one field with DateBegan and one I created in the
query CurrentDate:Now()

I tried the following in the querry:
TimeOnProg: ([CurrentDate]-[DateBegan])/12

See the following page at Allen Browne's web site:

Age() Function
http://members.iinet.net.au/~allenbrowne/func-08.html

Copy the function provided to a standard module (global module, not one behind a
form or report) and use as follows:

TimeOnProg: Age([DateBegan], Date())

--
Bruce M. Thompson, Microsoft Access MVP
(e-mail address removed) (See the Access FAQ at http://www.mvps.org/access)within the newsgroups so that all might benefit.<<


.
 
I have a database that records the date began. I need to
generate a report that lists time on the program.

How can I subtract dates and come up with years.

Put a calculated field in a Query:

Age: DateDiff("yyyy", [DateBegan], Date()) - IIF(Format([DateBegan],
"mmdd") > Format(Date(), "mmdd"), 1, 0)
 
I'm afraid that didn't help me much. I am not using
modules, i am only using it in a querry.

I am a beginner but I learn quick.

it wouldn't accept TimeOnProg1: Age([DateBegan],Date())

it didn't know what Age was.

I went to the web site and I don't want to use any VB

No problem. John Vinson's solution will give you the same result as it uses the
same technique that the function does.

:-)
 
Back
Top