Working days

G

Guest

I have a check box that when checked brings up the present date in one field
which in turn updates another field to be 3 days on from that!
I however need this to be 3 working days and was thinking that the formula
would need to be:

Private Sub Quote_Sent_AfterUpdate()
If Me![Quote Sent] = -1 Then
Me![Contract Quote Date] = Date
Me![Chase Up Date] = dhAddWorkDaysA(3, [Contract Quote Date])
End If

This does however not seem to work
Any ideas?
Matt
 
P

pietlinden

is this something from Access developer's Handbook, in which case the
function would be "adhAddWorkDaysA(...)"? Don't know. I didn't write
the code. The 3 Wise Men did.

Arvin Meyer has code that does that at his website. www.datastrat.com.
Simple and straightforward. Go to the downloads page, and there it is.
 
R

ruralguy via AccessMonster.com

Here's a function to put in a standard module called basDateFunctions.

Public Function PlusWorkdays(dteStart As Date, intNumDays As Long) As Date

PlusWorkdays = dteStart
Do While intNumDays > 0
PlusWorkdays = DateAdd("d", 1, PlusWorkdays)
If Weekday(PlusWorkdays, vbMonday) <= 5 Then
'-- If you have a Holiday Table use the next IF instead!
' If Weekday(PlusWorkdays, vbMonday) <= 5 And _
IsNull(DLookup("[Holiday]", "tblHolidays", _
"[HolDate] = " & Format(PlusWorkdays, "\#mm\/dd\/yyyy\#;;;\N\u\l\l")))
Then
'-- The above Format of PlusWorkdays works with US or UK dates!
intNumDays = intNumDays - 1
End If
Loop
End Function



Matt said:
I have a check box that when checked brings up the present date in one field
which in turn updates another field to be 3 days on from that!
I however need this to be 3 working days and was thinking that the formula
would need to be:

Private Sub Quote_Sent_AfterUpdate()
If Me![Quote Sent] = -1 Then
Me![Contract Quote Date] = Date
Me![Chase Up Date] = dhAddWorkDaysA(3, [Contract Quote Date])
End If

This does however not seem to work
Any ideas?
Matt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top