Hi!
I'm used to Excel, and trying to convert some things I've done there to Access. (Without using a Reference to the Excel Object Library in my Access Project)
I'm looking for the VBA equivalent of this Excel formula:
Which gives me the SerialDate # of the last day of last month.
Maybe a combo of VBA's Month function and DateAdd and Dateserial? I could envision a Case Select structure with 3 Cases; one for the months with 30 days, one for the months with 31 days, and one for February. Then you could just decrement Today's Month by one (unless it is 1 then it becomes 12, and you decrement the Year by 1), then use the case select for the appropriate Day value of the decremented Month. Sounds like the makings of a Custom Function for my project.
Is there something more concise within VBA already?
Looking for a quick tip so I don't reinvent the wheel. Excel's Worksheet Function EOMONTH is nice because it inherently knows how many days each month has.
Thanks in advance...
Shred
I'm used to Excel, and trying to convert some things I've done there to Access. (Without using a Reference to the Excel Object Library in my Access Project)
I'm looking for the VBA equivalent of this Excel formula:
Code:
=EOMONTH(TODAY(),-1)
Which gives me the SerialDate # of the last day of last month.
Maybe a combo of VBA's Month function and DateAdd and Dateserial? I could envision a Case Select structure with 3 Cases; one for the months with 30 days, one for the months with 31 days, and one for February. Then you could just decrement Today's Month by one (unless it is 1 then it becomes 12, and you decrement the Year by 1), then use the case select for the appropriate Day value of the decremented Month. Sounds like the makings of a Custom Function for my project.
Is there something more concise within VBA already?
Looking for a quick tip so I don't reinvent the wheel. Excel's Worksheet Function EOMONTH is nice because it inherently knows how many days each month has.
Thanks in advance...
Shred