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 / General 1 / December 2005

Tip: Looking for answers? Try searching our database.

Function DatePart(), how to subtract the month from a date field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
S. van Beek - 16 Dec 2005 18:26 GMT
Dear reader,

With DatePart() you can subtract the year or the week from a date field
with:

           DatePart("yyyy";[DateField])      for the year

           DatePart("ww";[DateField])        for the week

But how can I subtract the month or the combination of year & month from a
date field?

           DatePart("mmm";[DateField])      dos not work

Tanks for any help.

Kind regards,

Simon van Beek
Rick Brandt - 16 Dec 2005 18:37 GMT
> Dear reader,
>
[quoted text clipped - 9 lines]
>
>            DatePart("mmm";[DateField])      dos not work

Just use one "m".

Signature

I don't check the Email account attached
to this message.     Send instead to...
RBrandt    at       Hunter      dot      com

Randy Harris - 16 Dec 2005 18:43 GMT
> Dear reader,
>
[quoted text clipped - 15 lines]
>
> Simon van Beek

Simon, I think you mean extract rather than subtract. Try:

DatePart("m", [DateField])
or
Month([DateField])

Signature

Randy Harris
tech at promail dot com
I'm pretty sure I know everything that I can remember.

King Ron - 16 Dec 2005 20:20 GMT
<fake pirate voice>
Actual lad, ye needs to use the DateAdd() funk-she-own.

DateAdd("m", -6, MyDate)

will return the date 6 months previous.

Arrrgh. matey

</fake pirate voice>

King Ron of Chi
 
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.