After watching (How to Calculate Work Days Between Two Dates in Microsoft Access. Similar to Excel NETWORKDAYS.) on youtube.
Public Function MyLeaveDays(StartLeave As Date, EndLeave As Date) As Long Dim D As Date Dim C As Date MyLeaveDays = 0 D = StartLeave C = EndLeave While D < C MyLeaveDays = MyLeaveDays + 1 D = D + 1 Wend End Function
This is the code, but I want a way to get also: if 1/2/23 < 2/2/23 then MyLeaveDays = 2 but it would only give out 1 not 2 so if the dates are equal then output 1 if the dates are two dates then output 2 else if the dates are more then output 3,4,5...etc
Kevin Robertson
@Reply 3 years ago
Just add an equals sign.
While D <= C
Sorry, only students may add comments.
Click here for more
information on how you can set up an account.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Visitor Forum.