By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,248 Members | 1,961 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,248 IT Pros & Developers. It's quick & easy.

financial calendar date function

P: 25

Can someone please help me with my calendar function? I'm using access 2003 by the way.

Here is my problem: I have a receiver database that user will enter date of items received in a text box. It is set up as today's date, but user can change it to a back date. Now I want to create a function that check if today's date fall in whatever financial calendar month then user can't back dated later than that month financial calendar month.
for example, if today is 5/7/2012, then user only able to back dated this field from 4/30/12 to 5/6/2012.

here is my function for starter and I know it's wrong and I can't seems to figure it out
Expand|Select|Wrap|Line Numbers
  1. Function fCalAcctgDate(dteRcvDate) as date
  2. If dteRcvDate >= #4/2/2012# And dteRcvDate <= #4/29/2012# Then
  3.   fCalAcctgDate between #4/2/2012# and #4/29/2012#
  4. ElseIf dteRcvDate >= #4/30/2012# And dteRcvDate <= #5/27/2012# Then
  5.   fCalAcctgDate between #4/30/2012# and #5/27/2012#
  6. Else
  7.   fCalAcctgDate = Null
  8. End If
  9. End Function
could someone please help me?

Thank you in advance
May 7 '12 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 15k+
P: 31,419
that month financial calendar month.
What does that mean? Without an explanation and a definition of how this should be determined, the question cannot be answered adequately.
May 7 '12 #2

P: 759
Any function must return one result (there are some exceptions but not in this case).
Your function is defined As Date. So must return a (one = single) date value, not a range as seems you try by using between.
May 8 '12 #3

Post your reply

Sign in to post your reply or Sign up for a free account.