此代码很旧,可能会有所改进。
如果有人认为他们可以为此功能生成更好的代码,请继续,并告诉我您的努力。 如果我觉得更好(更有效,
100%准确 ),然后我将其替换。在此之前,它至少是一个可用版本,供访客在有需要时使用。
'MoveWD moves datThis on by the intInc weekdays.
Public Function MoveWD(datThis As Date, intInc As Integer) As Date
MoveWD = datThis
For intInc = intInc To Sgn(intInc) Step -Sgn(intInc)
MoveWD = MoveWD + Sgn(intInc)
Do While (Weekday(MoveWD) Mod 7) < 2
MoveWD = MoveWD + Sgn(intInc)
Loop
Next intInc
End Function
From: https://bytes.com/topic/access/insights/591016-function-move-forwards-backwards-through-weekdays