Get Month and/or Quarter numbers/names

YNWA

Registered User.
Local time
Today, 15:14
Joined
Jun 2, 2009
Messages
905
Hi,

I have a field, DateContractSigned.

Then I have 2 other fields MonthSigned and QuarterSigned.

Does anyone have the VBA for an AfterUpdate Event (or better) to populate Month and Quarter fields?

eg. If I enter 01/06/2012 in DateContractSigned, the MonthSigned field will read 06 or June and the QuarterSigned field will read 1.

If I had 25/07/2012 then Month would be 7 or July and Quarter would be 2?

Cheers
 
You can use DatePart() method to extract the Month/Quarter..
Code:
DatePart("m",#06/01/2012#)    [COLOR=Teal]'Will give month number 6[/COLOR]
MonthName(DatePart("m", #06/01/2012#))   [COLOR=Teal] 'Will give the Month June[/COLOR]
DatePart("q",#06/01/2012#)    [COLOR=Teal]'Will give Quarter 2[/COLOR]
 

Users who are viewing this thread

Back
Top Bottom