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!

Calculate Week Days Difference

Status
Not open for further replies.

CliffSP

IS-IT--Management
Jul 22, 2005
30
Hi all

What expression can I use to calculate the difference between 2 dates, but excluding weekends. i.e. A helpdesk call was logged on Thursday and closed on Tuesday. I want the answer to be 2 days and not 4 (as in including Saturday & Sunday).

TIA


Cliff
 
Thanks PHV - I've looked at that code and pasted it into a new module, but when I run my query:

CallAge: DateDiffW("d",[Date Opened],[Date Closed])

I get this error message:

Undefined Function 'DateDiffW' in expression.

Where should I have pasted that code?

TIA

Cliff
 
It needs to be a standard module, not a form/reports module (i e, in VBE - Insert | Module) - and - name the module something other than the function name.

If you wish to exclude also hollidays (i e return only workdays), have a look at MichaelRed's faq faq181-261.

Roy-Vidar
 
Many thanks guys - all sorted.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top