DatePart Question

  • Thread starter question about Datepart
  • 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
 
M

Marshall Barton

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())
 
A

Art

-----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
 
V

Van T. Dinh

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

DatePart("ww", Date())
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top