Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Fiscal Date default value

0 views
Skip to first unread message

Drayton

unread,
Mar 31, 2005, 2:39:02 PM3/31/05
to
Greetings all.
My body is at work, but my brain must be on vacation because I can't seem to
get this right. I have a form used to hold the beginning and ending dates for
a date range query. I need to use fiscal dating (22nd thru the 21st) I am
having an issue getting the begin date correct. If the current date is the
21st or less, I need the begin default value to be the 22nd of the PREVIOUS
month. On the 22nd or greater, I need the begin date to be the 22nd of the
CURRENT month. My logic is failing as this should be relatively easy.
My current default date string looks like this and sets the begin date to
the 1st of the current month:
=IIF(FORMAT(DATE(),"DD"=1,DATEADD("M",-1,DATE()),(DATE()-DAY(DATE())+1))
Format for value mm/dd/yy
HELP!

Dirk Goldgar

unread,
Mar 31, 2005, 4:25:32 PM3/31/05
to
"Drayton" <Dra...@discussions.microsoft.com> wrote in message
news:DB5C88B1-B985-449B...@microsoft.com

There may be a better way, but I think this does what you want:

=IIf(Day(Date())< 22,
DateSerial(Year(Date()), Month(Date()) - 1, 22),
DateSerial(Year(Date()), Month(Date()), 22))

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


John Vinson

unread,
Mar 31, 2005, 4:40:49 PM3/31/05
to

You're doing this the HARD way!

DateSerial(Year(Date()), Month(Date()) - IIF(Day(Date() < 22, 1, 0),
22)


John W. Vinson[MVP]

Dirk Goldgar

unread,
Mar 31, 2005, 4:49:16 PM3/31/05
to
"John Vinson" <jvinson@STOP_SPAM.WysardOfInfo.com> wrote in message
news:9gro4154bu2f4mba1...@4ax.com

>
> DateSerial(Year(Date()), Month(Date()) - IIF(Day(Date() < 22, 1, 0),
> 22)

Yours is better than mine.

Drayton

unread,
Apr 1, 2005, 8:05:06 AM4/1/05
to
Thanks for the prompt response!
0 new messages