Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / August 2007

Tip: Looking for answers? Try searching our database.

Help with DateDiff

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Antney - 17 Aug 2007 01:43 GMT
How do I subtract the current date from a date in a table field?

I have dates in a field, e.g. 7/15/1980, and in my query, I have the current
date, Date(). I am trying to subtract the two and get the age in years. My
function works, but I am getting a message box, stating that I don't have
Date() as one of my tables parameters.

I want to get rid of the message box and have the query do the calculations
without any user prompts. Here is my function - Age:
DateDiff("yyyy",[DOB],[Date()])

Can anyone help me with this?

Antney
Ofer Cohen - 17 Aug 2007 01:47 GMT
Remove the square brackets from the date function, other wise it will look
for a field with this name

DateDiff("yyyy",[DOB],Date())

Also, see this link:

   http://www.mvps.org/access/datetime/date0001.htm
   Date/Time: Calculate Age of a person

Signature

Good Luck
BS"D

> How do I subtract the current date from a date in a table field?
>
[quoted text clipped - 10 lines]
>
> Antney
Antney - 17 Aug 2007 01:54 GMT
Of course!

Thank you!!

> Remove the square brackets from the date function, other wise it will look
> for a field with this name
[quoted text clipped - 20 lines]
> >
> > Antney
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.