Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get data within fiscal year 2

Status
Not open for further replies.

THWatson

Technical User
Joined
Apr 25, 2000
Messages
2,601
Location
CA
Using Access 2003

The fiscal year is October 1 through September 30.

tblAttendance holds the data re meetings attended by members.

The user selects two dates in order to get attendance data between those dates.

What I want to do is determine whether or not the date range falls within the proper fiscal year.

Following is the query column
Code:
IIf(Month(Date())<=9,Between DateSerial(Year(Date()-1),10,1) And DateSerial(Year(Date(),9,30),Between DateSerial(Year(Date(),10,1) AND DateSerial(Year(Date()+1),9,30)

What this is supposed to do is...
1. If the Month in which we are currently is less than 9 (September) the query checks between October 1 one year ago and September 30 of this year.
2. However, if the Month in which we are currently is October through December, the query checks between October 1 of the current year and September 30 of the next year.

Does the code make sense in that regard?

Thanks.

Tom
 
As an addendum...

The IIf statement as above returns no records.

The following, without the IIf, returns records.
Code:
Between DateSerial(Year(Date())-1,10,1) And DateSerial(Year(Date()),9,30)

Here is the entire SQL for the query...without the IIf
Code:
SELECT qryAttendance.AttendanceID, qryAttendance.MemberID, qryAttendance.MeetingDate
FROM qryAttendance
WHERE (((qryAttendance.MeetingDate) Between DateSerial(Year(Date())-1,10,1) And DateSerial(Year(Date()),9,30)));

Tom

 
Between DateSerial(Year(Date())+(Month(Date())<=9),10,1) And DateSerial(Year(Date())-(Month(Date())>10),9,30)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thanks, PHV. That's super.

Duane, thanks for drawing attention to that. I gathered that from mulling over PHV's post. Hadn't realized that. Or I had realized it and forgot it, which could also be possible.

Always appreciated.

Tom

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top