G Guest Nov 9, 2004 #1 How do I build a query expression to calculate number of weekdays between two dates?
G Graham R Seach Nov 10, 2004 #2 See the DateDiff function: SELECT DateDiff("d", Date1, Date2) As DaysBetween2Dates FROM tblMyTable Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Microsoft Access 2003 VBA Programmer's Reference http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
See the DateDiff function: SELECT DateDiff("d", Date1, Date2) As DaysBetween2Dates FROM tblMyTable Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Microsoft Access 2003 VBA Programmer's Reference http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
G Graham R Seach Nov 10, 2004 #3 Oops, sorry, I just realised you asked for weekdays. 'Number of weekdays between two dates, by Doug Steele MVP SELECT DateDiff("d", dte1, dte2) - DateDiff("ww", dte1, dte2, 1) * 2 - IIf(Weekday(dte2, 1) = 7, IIf(Weekday(dte1, 1) = 7, 0, 1), IIf(Weekday(dte1, 1) = 7, -1, 0)) As WeekdaysBetween2Dates FROM tblMyTable (watch out for newsreader word wrap) Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Microsoft Access 2003 VBA Programmer's Reference http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html
Oops, sorry, I just realised you asked for weekdays. 'Number of weekdays between two dates, by Doug Steele MVP SELECT DateDiff("d", dte1, dte2) - DateDiff("ww", dte1, dte2, 1) * 2 - IIf(Weekday(dte2, 1) = 7, IIf(Weekday(dte1, 1) = 7, 0, 1), IIf(Weekday(dte1, 1) = 7, -1, 0)) As WeekdaysBetween2Dates FROM tblMyTable (watch out for newsreader word wrap) Regards, Graham R Seach Microsoft Access MVP Sydney, Australia Microsoft Access 2003 VBA Programmer's Reference http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html