datestart = #04/jan/2009#
DateEnd = #08/feb/2009#
?1+int( (DateEnd-dateStart)/7 )
6
Seems to be fine...
datestart = #05/jan/2009#
DateEnd = #07/feb/2009#
?1+int((DateEnd-dateStart)/7 )
5
This breaks... off by the "+1" part, this is because datestart is less (in weekday) than dateend (monday vs saturday)
Add a simple IIF to check for this occurance and fix it... (i.e. Prevent the 1 from beeing added), like so:
datestart = #05/jan/2009#
DateEnd = #08/feb/2009#
?iif(weekday(datestart, vbmonday) < Weekday(dateend, vbmonday),0,1)+int( (DateEnd-dateStart)/7 )
4
while
datestart = #04/jan/2009#
DateEnd = #08/feb/2009#
?iif(weekday(datestart, vbmonday) < Weekday(dateend, vbmonday),0,1)+int( (DateEnd-dateStart)/7 )
6
Still works too
Good luck !