PC Review


Reply
Thread Tools Rate Thread

Allen Browne's Recurring events

 
 
george 16-17
Guest
Posts: n/a
 
      25th May 2010
Greetings all,

I am working on a small staff scheduling db based on Allen Browne's
Recurring events. See http://allenbrowne.com/AppRecur.html.

I have added a work day function based on Arvin Meyer's function -
http://www.datastrat.com/Code/GetBusinessDay.txt.

It works fine if I add consecutive workdays, where the period frequency is
one. I cannot seem to modify the code where the period frequency is greater
than one. Meaning, I would like to be able to schedule staff Monday through
Friday every two weeks and not every week. Is this possible?

Instead of the built in Dateadd function, I am trying to write my own
function (and struggling). Here is the modified function:

Public Function DateRecur(strInterval As String, intDayAdd As Integer, _
dteStart As Date) As Date
On Error GoTo Error_Handler
'Adds/Subtracts the proper Business day skipping holidays and weekends
'Requires a table (tblHolidays) with a date field (HolidayDate)
'Arvin Meyer 05/26/98 revised 3/12/2002
'Dim rst As DAO.Recordset
'Dim DB As DAO.Database
'Dim strSQL As String
'Set DB = CurrentDb
'Set rst = DB.OpenRecordset("SELECT [HolidayDate] FROM tblHolidays",
dbOpenSnapshot)

Select Case strInterval
Case "dw"
'work days only (MTWRF)
If intDayAdd > 0 Then
Do While intDayAdd > 0
dteStart = dteStart + 1
'rst.FindFirst "[HolidayDate] = #" & dteStart & "#"
If Weekday(dteStart) <> 1 And Weekday(dteStart) <> 7 Then
'If rst.NoMatch Then intDayAdd = intDayAdd - 1
intDayAdd = intDayAdd - 1
End If
Loop
End If
Case Else
'typical dateadd - d,ww,m,q,yyyy,
DateRecur = DateAdd(strInterval, intDayAdd, dteStart)
End Select

Exit_Here:
‘rst.Close
‘Set rst = Nothing
‘Set DB = Nothing
Exit Function

Error_Handler:
MsgBox Err.Number & ": " & Err.Description
Resume Exit_Here
End Function

I hope this makes sense and thanks in advance,

george

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Allen Browne Help!!! Billiam Microsoft Access 7 19th Aug 2008 03:17 AM
Allen Browne siggy Microsoft Access Form Coding 1 5th Aug 2006 08:42 AM
To Allen Browne =?Utf-8?B?U2FtIHlvbmc=?= Microsoft Access VBA Modules 2 12th Sep 2005 01:57 PM
Thanks for your help, Allen Browne =?Utf-8?B?QW5uZQ==?= Microsoft Access VBA Modules 1 20th Nov 2004 05:01 AM
Allen Browne Kasey Microsoft Access Forms 4 5th Aug 2004 12:52 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:21 AM.