cath_hopes
Registered User.
- Local time
- Today, 16:42
- Joined
- Oct 17, 2007
- Messages
- 52
Hi there,
I'm looking for some code to get a value of format 'Month YYYY' for this month, this month +1, +2 and this month -1 etc., then put it into a caption, but will be using it for other things too.
I've tried the following:
Dim Month1ago As Date
Dim Month2ago As Date
...
Month1ago = Month(Date) - 1
Me.Command13.Caption = Format$(Month1ago, "mmmm yyyy", 0, 0)
This returns Me.Command13.Caption with January 1900. So the format is wrong and Month(Date) - 1 seems to be removing a day rather than a month. There must be a simple answer to this. Can someone point me in the right direction?
Many thanks in advance!
Catherine
I'm looking for some code to get a value of format 'Month YYYY' for this month, this month +1, +2 and this month -1 etc., then put it into a caption, but will be using it for other things too.
I've tried the following:
Dim Month1ago As Date
Dim Month2ago As Date
...
Month1ago = Month(Date) - 1
Me.Command13.Caption = Format$(Month1ago, "mmmm yyyy", 0, 0)
This returns Me.Command13.Caption with January 1900. So the format is wrong and Month(Date) - 1 seems to be removing a day rather than a month. There must be a simple answer to this. Can someone point me in the right direction?
Many thanks in advance!
Catherine