Need help with fiscal years!

P

Patrick

HI!!

I'm presently working with fiscal years and need to find a
way(programmaticaly) to discern if a date entered
coresponds to the fiscal year that there working on.

Example:
Lets say I'm using the FY: 2003/2004, which in turn
coresponds to the following range: 03-apr-01 to 04-Mar-31.

When a date is entered I want to know if its inside the
range or outside of it! Any ideas on how to do that.
So far i've tried-it using a If statement, but I don't
think that I'm realy working with the right statement. It
works only some times..

Here's an example:
If sysDate >= rgDate1 And sysDate <= rgDate2 Then
' date presently entered his between the acceptable range
' of the current Fiscal Year.

MsgBox "Its ok!"

Else
' Flag user, that the date entered is outside the curent
' FY range.

MsgBox "WARNING!! " & vbNewLine & "The system notice
that : '" & sysDate & "' " _
& " " & vbNewLine & " is not a suitable delivery date,
because its not a part of the " _
& " " & vbNewLine & " following fiscal year : [ from '"
& rgDate1 & "' to '" & rgDate2 & "' ]. " _
& " " & vbNewLine & " THIS IS ONLY A REMINDER!, you can
still use this date or " & vbNewLine & " " _
& "change-it for another one, its up to you."

End If

CAN ANYONE HELP ME OUT!!!

thanx in advanced,
Pat..
 
A

Allen Browne

If your fiscal year ends on March 31, you can define it by subtracting 3
months and taking the Year() of the result:

If Year(DateAdd("m", -3, [sysDate])) <> Year(DateAdd("m", -3, Date())) Then
MsgBox "sysDate is not in the current fiscal year"
End If
 
P

Patrick

WOW!! thanks alot... I just finished trying-it out and it
works great,thanx again!!!
-----Original Message-----
If your fiscal year ends on March 31, you can define it by subtracting 3
months and taking the Year() of the result:

If Year(DateAdd("m", -3, [sysDate])) <> Year(DateAdd ("m", -3, Date())) Then
MsgBox "sysDate is not in the current fiscal year"
End If

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

I'm presently working with fiscal years and need to find a
way(programmaticaly) to discern if a date entered
coresponds to the fiscal year that there working on.

Example:
Lets say I'm using the FY: 2003/2004, which in turn
coresponds to the following range: 03-apr-01 to 04-Mar- 31.

When a date is entered I want to know if its inside the
range or outside of it! Any ideas on how to do that.
So far i've tried-it using a If statement, but I don't
think that I'm realy working with the right statement. It
works only some times..

Here's an example:
If sysDate >= rgDate1 And sysDate <= rgDate2 Then
' date presently entered his between the acceptable range
' of the current Fiscal Year.

MsgBox "Its ok!"

Else
' Flag user, that the date entered is outside the curent
' FY range.

MsgBox "WARNING!! " & vbNewLine & "The system notice
that : '" & sysDate & "' " _
& " " & vbNewLine & " is not a suitable delivery date,
because its not a part of the " _
& " " & vbNewLine & " following fiscal year : [ from '"
& rgDate1 & "' to '" & rgDate2 & "' ]. " _
& " " & vbNewLine & " THIS IS ONLY A REMINDER!, you can
still use this date or " & vbNewLine & " " _
& "change-it for another one, its up to you."

End If

CAN ANYONE HELP ME OUT!!!

thanx in advanced,
Pat..


.
 
Top