Can you please help me to set a default for a date field. If I enter a new record any day of the week, I need the default date of THURSDAy for that week. Thanks in advance!
You can use the WEEKDAY() function to test which day of the week a date is.
So for a text box control called datControlName:-
Private Sub Form_Load()
datControlName = Date
While Weekday(datControlName) <> 5
datControlName = datControlName + 1
Wend
End Sub
This takes a Friday and adds 6 to get to the NEXT Thursday.
If you want a Friday date to go BACK to the previous Thursday then you'll have to do something else with the logic. ( Select Case perhaps )
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.