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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thursdays in a year excluding Christmas and New Years 1

Status
Not open for further replies.

THWatson

Technical User
Apr 25, 2000
2,601
CA
Using Access 2000

A club meets every Thursday. If a member attends all 52 Thursdays in a given year, he/she receives Perfect Attendance credit for that year. So, calculating whether or not the member achieved perfect attendance for a given year is relatively easy - compare the # of meetings attended to the number of weeks in that year.

However, in certain years (e.g. 2008) both Christmas and New Years days fell on Thursday. In those years, a member receives Perfect Attendance credit if she/he attended 50 meetings that year.

Is there a formula or function that calculates the number of Thursdays in a year excluding holidays?

Thanks.

Tom
 
You need dates:

? RetThur(#12/28/08#,#1/10/09#)


I am afraid I am a casual about declarations when I am not writing finished code :( You should probably add an error trap, as well.

 
Remou
Oh shoot...never even thought about entering the # delimeters. So used to entering dates in text boxes, I guess.

Also, been working on this too long today...need to take a break.

Yes, I will add error trap code.

Thanks.

Tom
 
Should this not work as a column in a query?
Code:
Thursdays: RetThur([Forms]![frmDateSelector]![txtStartDate],[Forms]![frmDateSelector]![txtEndDate])
where the StartDate and EndDate are fed from a form?

Doesn't seem to work even with # delimiters.

It results in a RunTime error, #13, and points to the For i = 0 To (dteEnd - dteStart) line in the RetThur function module.

Tom
 
You have run into a date problem again. The query is passing text, not dates, so best change the function, if you wish to use it this way:

Function RetThur(dteStart As Date, dteEnd As Date)


 
I apologize, Remou.

I thought the function was returning dates. I fixed it as you said, and it works fine now in the query.

Thanks.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top