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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax error on SQL Expression

Status
Not open for further replies.

tigerjade

Programmer
Mar 17, 2004
237
US
I have a SQL expression I'm trying to create, but when I check it, I'm getting the error "Syntax Error or Access Violation".

Code:
(SELECT Alias1."allMonth0" FROM History as Alias1 WHERE DATEPART(dd, Alias1."histDate") = DATEPART(dd, {?EndDate}) AND DATEPART(mm, Alias1."histDate") = DATEPART(mm, {?EndDate}) AND DATEPART(yy, Alias1."histDate") = DATEPART(yy, {?EndDate}))

Can anyone tell me why I'm getting this error?

Thanks!

tigerjade


"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live." -- Martin Golding


 
Looks like you're trying to use one of your parameter fields ({?EndDate}) in the SQL expression - that's not allowed.

Is the result for display, or is this something you're using in the record selection formula? If it's for display, perhaps you can use a subreport to get the intended allMonth0 value from your History table.

-dave
 
Thanx, Dave! That was indeed-y the problem. Actually, the expression is part of me trying to figure out how to get this data to display like I want it to; now I know it won't work. :)

Thanks!

tigerjade

"Always code as if the person who ends up maintaining your code will be a violent psychopath who knows where you live." -- Martin Golding


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top