DatePart Question

  • Thread starter Thread starter question about Datepart
  • Start date Start date
Q

question about Datepart

I hve tried putting the following code in the immediate
window but keep getting an invalid procedure call or
argument error.

?datepart(ww,Now())

Why won't this work?

What I want to be able to do is allow the users to print a
summary for the previous week without having to enter two
dates. I was thinking that if I could determine the
current week number of the year then I could pass
parameters to a query that would show all records from the
previous week. If anyone has a routine already that I
could use I would appreciate posting it. I know I will
have to account for the last week of the year but I think
I can handel that. Thanks
 
question said:
I hve tried putting the following code in the immediate
window but keep getting an invalid procedure call or
argument error.

?datepart(ww,Now())

Why won't this work?

What I want to be able to do is allow the users to print a
summary for the previous week without having to enter two
dates. I was thinking that if I could determine the
current week number of the year then I could pass
parameters to a query that would show all records from the
previous week. If anyone has a routine already that I
could use I would appreciate posting it. I know I will
have to account for the last week of the year but I think
I can handel that. Thanks


The first argument is a syring:

?datepart("ww",Now())
 
-----Original Message-----
I hve tried putting the following code in the immediate
window but keep getting an invalid procedure call or
argument error.

?datepart(ww,Now())

Why won't this work? a
summary for the previous week without having to enter two
dates. I was thinking that if I could determine the
current week number of the year then I could pass
parameters to a query that would show all records from the
previous week. If anyone has a routine already that I
could use I would appreciate posting it. I know I will
have to account for the last week of the year but I think
I can handel that. Thanks

.
Enclose the ww in double quotes: Datepart("ww",now())

Hope this helps
 
Enclose ww in double-quotes and you should use Date() rather than Now().

DatePart("ww", Date())
 
Back
Top