I'm making a form, and the user needs to be able to push a button and be able to see the start (Sunday) and end (Saturday) dates of the upcoming week. How do I get these values?
Dim curday As String, Nextsat As String
curday = Date
Do Until DatePart("w", curday, vbSunday) = 1 ' add days till sunday
curday = DateAdd("d", 1, curday)
Loop
Nextsat = DateAdd("d", 6, curday)
I wouldn't make the poor overworked user do the mouse thing, just put the date(s) on the form during hte form activate event.
Of course, I only showed the Sunday Calculation (and even that could be simplified a bit) so you can use braindead2's suggestion for the following Saturday.
MichaelRed
mred@att.net
There is never time to do it right but there is always time to do it over
" ... make into a function ... "? It IS a function. An Intrinsic one. the porper name is "DateAdd". UDF's would normally consist of a bit more than the one liner.
MichaelRed
mred@att.net
There is never time to do it right but there is always time to do it over
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.