Compile Error

  • Thread starter Thread starter GRayL
  • Start date Start date
G

GRayL

I have a simple one-column table for all the days(var) in
2004. I want to remove the Weekend dates. Just to be
sure, I use a simple select query before I use the delete
query:

"Select *, var from Days2004 where weekday(var) = 1 or
weekday(var) = 7.

I keep getting a compile error in the statement 'weekday
(var)= 1 or weekday(var) = 7.

This has really ruined my weekend. Help!
 
Your SQL statement looks ok, but you might try

SELECT *
FROM Days2004
WHERE WeekDay([Var]) = 1 OR
WeekDay([Var]) = 7

Since you didn't post the exact error you receive, it is hard to guess what the
problem is. You might have a references problem. Or since VAR is a SQL
function to calculate Variance, then that may be (and probably is) your problem.
Surrounding Var with brackets should cause Access to realize you are looking to
use a field named "var".

Another way to be sure would be to use the full tablename.fieldname syntax.

SELECT [Days2004].*
FROM Days2004
WHERE WeekDay([Days2004].[Var]) = 1 OR
WeekDay([Days2004].[Var]) = 7
 
Back
Top