SQL Statement

N

news

Here is the error message that I get. To view the my code read e-mail above.

run-time error '3075'
syntax error (mising operator) in query expression
'((([Pgm_str_dt_Formated]+120 AS [Complete By], )Between #08/25/04# And
#12/30/04#) AND ((FLDVST.TW)=-1) AND
((Purpose.PURPOSE)="Provider Orientation/Education"))'.
 
K

Ken Snell [MVP]

Look at the segment of the SQL statement that is shown in the error message.
The syntax is all wrong:

-- there should not be a comma after the [Complete By]
-- there should not be a [Complete By] in a HAVING clause

The problem is that you're trying to use the wrong variable in the HAVING
clause area. The variable that you're using is one that appears to be more
correct as a "field name expression" in the SELECT clause (it contains an AS
portion and a comma, see above). You need to define a different variable
that contains just the correct information for the HAVING clause and use
that variable in your SQL statement building.

The clause is being built correctly per how you've provided data. It just
isn't the right SQL syntax. Change your code.
 
Top