How calculate days difference in weekdays

I have this in a query but want to adjust it to calculate weekdays.  What is the correct syntax for that?

LateDays: DateDiff("d",[DropDueDate],[ReschDropDueDate])

--Steve
Who is Participating?

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Database Architect / Systems AnalystCommented:
DateDiff("w",[DropDueDate],[ReschDropDueDate])
Database Architect / Systems AnalystCommented:
more ...
Capture1.gif
Commented:
if by weekdays you mean, excluding weekends, place this codes in a regular module

``````Function getWeekDays(vDate1 As Date, vDate2 As Date) As Long
Dim i As Long, dtStart
If vDate1 = vDate2 Then getWeekDays = 0: Exit Function

dtStart = vDate1
i = DateDiff("d", vDate1, vDate2) + 1
Do Until dtStart >= vDate2
dtStart = dtStart + 1
Do While Weekday(dtStart) = 1 Or Weekday(dtStart) = 7
dtStart = dtStart + 1
i = i - 1
Loop
Loop

getWeekDays = i
End Function
``````

LateDays: getWeekDays([DropDueDate],[ReschDropDueDate])

Author Commented:
Hmmm, when I run it I get a "Data type mismatch in criteria expression.

???
Database Architect / Systems AnalystCommented:
Steve ... are you trying to account for weekends or not?
mx
Author Commented:
I want to EXCLUDE weekends.  So for example, if DropDueDate was 4/21/2011 and ReschDropDueDate was 4/25/2011 the answer should be 2.
Database Architect / Systems AnalystCommented:
Then ignore my first post.  Probably good to mention that in the original Q :-)

mx
Commented:
what Criteria? i don't see any criteria in the expression you posted
Author Commented:
I want to EXCLUDE weekends.  So for example, if DropDueDate was 4/21/2011 and ReschDropDueDate was 4/25/2011 the answer should be 2.
Commented:
so, where is the criteria
Author Commented:
Here is my SQL...

SELECT tblProjectDetail.DetailID, tblProjectDetail.JobN, tblProjectDetail.Complete, tblProject.CompanyName, tblProject.ProjType, tblProjectDetail.DropDueDate, tblProjectDetail.ReschDropDueDate, getWeekDays([DropDueDate],[ReschDropDueDate]) AS LateDays, tblRescheduleReasons.Reason
FROM (tblProjectDetail LEFT JOIN tblProject ON tblProjectDetail.JobN = tblProject.JobN) LEFT JOIN tblRescheduleReasons ON tblProjectDetail.JobN = tblRescheduleReasons.JobN
WHERE (((tblProjectDetail.Complete)=True) AND ((getWeekDays([DropDueDate],[ReschDropDueDate]))>0));
Commented:
check if you have null values in fields [DropDueDate] and [ReschDropDueDate]

Experts Exchange Solution brought to you by