PC Review


Reply
Thread Tools Rate Thread

Date Difference networkdays not accepted in Access.

 
 
=?Utf-8?B?RGF2aWRfV2lsbGlhbXNfUEcgKCk=?=
Guest
Posts: n/a
 
      2nd Aug 2007
Want to calculate the number of days between two dates and not include
weekends. Have tried entering -
time: networkdays([Date of entry],[Date completed])

as a query calculation - but this is not
recognised. (Works great in Excel !!) Happy to use VB but looking for
suggestions,

Any ideas much appreciated,
David


 
Reply With Quote
 
 
 
 
=?Utf-8?B?RGFuaWVs?=
Guest
Posts: n/a
 
      2nd Aug 2007
Have you taken a look at

http://www.mvps.org/access/datetime/date0012.htm

I think this is what you're looking for.
--
Hope this helps,

Daniel P






"David_Williams_PG ()" wrote:

> Want to calculate the number of days between two dates and not include
> weekends. Have tried entering -
> time: networkdays([Date of entry],[Date completed])
>
> as a query calculation - but this is not
> recognised. (Works great in Excel !!) Happy to use VB but looking for
> suggestions,
>
> Any ideas much appreciated,
> David
>
>

 
Reply With Quote
 
=?Utf-8?B?S2xhdHV1?=
Guest
Posts: n/a
 
      2nd Aug 2007
Here is a function designed for that purpose. It includes reference to a
holiday table so holidays on any non working day not on a weekend can be
excluded. All you need for the holiday table is a date field and a text
descripton field.

'---------------------------------------------------------------------------------------
' Procedure : CalcWorkDays
' DateTime : 5/8/2006 16:34
' Author : Dave Hargis
' Purpose : Counts the number of days between two dates excluding Saturdays,
' : Sundays, and any days in the Holidays tabl
'---------------------------------------------------------------------------------------
'
Function CalcWorkDays(dtmStart As Date, dtmEnd As Date) As Integer

On Error GoTo CalcWorkDays_Error

'Calculates the number of days between the dates
'Add one so all days are included
CalcWorkDays = DateDiff("d", dtmStart, dtmEnd) - _
(DateDiff("ww", dtmStart, dtmEnd, 7) + _
DateDiff("ww", dtmStart, dtmEnd, 1)) + 1
'Subtract the Holidays
CalcWorkDays = CalcWorkDays - DCount("*", "holidays", "[holdate] between
#" & dtmStart & "# And #" & dtmEnd & "#")

CalcWorkDays_Exit:

On Error Resume Next
Exit Function

CalcWorkDays_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & _
") in procedure CalcWorkDays of Module modDateFunctions"
GoTo CalcWorkDays_Exit

End Function


--
Dave Hargis, Microsoft Access MVP


"David_Williams_PG ()" wrote:

> Want to calculate the number of days between two dates and not include
> weekends. Have tried entering -
> time: networkdays([Date of entry],[Date completed])
>
> as a query calculation - but this is not
> recognised. (Works great in Excel !!) Happy to use VB but looking for
> suggestions,
>
> Any ideas much appreciated,
> David
>
>

 
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
Date Difference - Networkdays function not working John Microsoft Excel Misc 6 8th Oct 2009 03:41 PM
Meeting settings difference when received & accepted Dave Kravitt Microsoft Outlook Calendar 0 17th Dec 2007 10:49 PM
Create Formula - Add # of Networkdays to a specific start date to find an end date bdicarlo1@yahoo.com Microsoft Excel Discussion 3 9th Jan 2007 01:40 PM
Networkdays function doesn't find true difference between two dat =?Utf-8?B?c2VzbGVyMg==?= Microsoft Excel Worksheet Functions 5 5th Oct 2006 03:32 PM
Calculating days between current date and a date in future NETWORKDAYS() function Faheem Khan Microsoft Excel Worksheet Functions 2 10th Feb 2005 08:18 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:53 PM.