financial calendar date function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Bay0519
    New Member
    • Jun 2009
    • 25

    financial calendar date function

    Hi,

    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
    Code:
    Function fCalAcctgDate(dteRcvDate) as date
    If dteRcvDate >= #4/2/2012# And dteRcvDate <= #4/29/2012# Then
      fCalAcctgDate between #4/2/2012# and #4/29/2012#
    ElseIf dteRcvDate >= #4/30/2012# And dteRcvDate <= #5/27/2012# Then
      fCalAcctgDate between #4/30/2012# and #5/27/2012#
    Else
      fCalAcctgDate = Null
    End If
    End Function
    could someone please help me?

    Thank you in advance
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32633

    #2
    Originally posted by Bay0519
    Bay0519:
    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.

    Comment

    • Mihail
      Contributor
      • Apr 2011
      • 759

      #3
      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.

      Comment

      Working...