Prev: DateDiff
Next: Querying Dates
From: pat67 on 18 Mar 2010 17:02 On Mar 18, 3:14 pm, John W. Vinson <jvinson(a)STOP_SPAM.WysardOfInfo.com> wrote: > On Thu, 18 Mar 2010 10:55:02 -0700 (PDT), pat67 <pbus...(a)comcast.net> wrote: > >I actually do have one more question for any of you guys. The query is > >working like i said, but could you explain to me hwo each part works > >and how it dissemintaes the data? > > Glad you got it working. To break this down: > > >= DateAdd("d", -6-Weekday(Date(), 2) , Date()) AND < DateAdd("d",1-weekday(Date(),2),Date()) > > Work from the inside out. The Date() function returns today's date from the > computer clock. The Weekday() function returns the day of the week; the > (optional) 2 after the date means to start the week on Monday rather than the > default Sunday; the function returns numbers 1 through 7, with 1 meaning > Monday, 2 Tuesday and so on. > > So since today is 3/18, Weekday(Date(), 2) is 4 (Mon, Tue, Wed, Thu). > Subtracting 4 days from today using the DateAdd function, and then 6 more days > from that ( the -6-Weekday bit) gives the date of Monday last week. The second > dateadd does the same thing for the date of Monday this week. > -- > > John W. Vinson [MVP] thanks. I really appreciate it. |