Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why DatePart not working?

Status
Not open for further replies.

marcon

Programmer
Aug 30, 2001
21
0
0
US
It sure looks straight forward butI keep getting errors.
Ultimately, I want to group sales by week, but in just testing this function I keep getting an error. Read and reread the help files....

Any insight or comments are greatly appreciated. Thanks!

SalesDate is a date/time data type
Sales is a double.

DatePart("ww",[SalesDate])

in field of my query : Expr1: DatePart("ww",[SalesDate])


qry results :
SalesDate Sales Expr1
1/1/2003 1 #ERROR
 
It has nothing to do with the DatePart function. I am betting that in your GROUP BY statement you are grouping by Expr1. You can't use that name. You must use the original expression:
GROUP BY DatePart("ww",[SalesDate])

Let me know if that helps.
Bob Scriver
 
Thanks for your response. unfortunately this is
before I grouped the data. This is an access97
database running on xp.
I wonder if that has something to do with it.
 
No, I write mostly 97 with XP and that should't be a problem. Copy and paste the SQL from the query here and let me take a look at it all. Bob Scriver
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top