Next Day of the Week.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,
I have a form that uses a “testDate†as a Date. I’m looking to have another
field “auditDate†that will always be the Tuesday that follows the “testDateâ€.
Any help would be great.

Thanks,
 
Try the following

Function FindNextDay(dtDate As Variant) As Variant

For I = 1 To 6
dtDate = DateAdd("d", 1, dtDate)
If Weekday(dtDate) = vbTuesday Then
FindNextDay = dtDate
Exit For
End If
Next I

End Function

In yours case you'll call the fundtion using testDate as an input variable

dtNextTuesday = FindNextDay(Me.testDate)
 
Hi Daniel,

This works but you'll need to add:
Dim I As Integer
and
For I = 1 To 7

Thanks,
 
Back
Top