Parameter clause syntax error

S

scubadiver

I have looked at my SQL and changed the bracketing but now it says there is
a syntax error in the parameter clause:

PARAMETERS >=[forms]![reports form]![DateFrom] And <=[forms]![reports
form]![DateTo] DateTime;
 
S

scubadiver

I don't understand the question. I don't do this much so an explanation
would be handy. Thanks


Jeff Boyce said:
What is the value of "PARAMETERS"? Your SQL statement seems to be
attempting to compare PARAMETERS to date values, which would give you a
Boolean (T/F), but you've given it DateTime data type.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

scubadiver said:
I have looked at my SQL and changed the bracketing but now it says there is
a syntax error in the parameter clause:

PARAMETERS >=[forms]![reports form]![DateFrom] And <=[forms]![reports
form]![DateTo] DateTime;
 
J

Jeff Boyce

How did you arrive at the SQL statement you posted? Can you give us a bit
more context?

That SQL statement starts out PARAMETERS <= ..., which will, if it works at
all, give you a yes/no, true/false "boolean" value. The end of your SQL
statement is DateTime, which attempts to set the value to a DateTime value.
Boolean <> DateTime.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

scubadiver said:
I don't understand the question. I don't do this much so an explanation
would be handy. Thanks


Jeff Boyce said:
What is the value of "PARAMETERS"? Your SQL statement seems to be
attempting to compare PARAMETERS to date values, which would give you a
Boolean (T/F), but you've given it DateTime data type.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

scubadiver said:
I have looked at my SQL and changed the bracketing but now it says
there
is
a syntax error in the parameter clause:

PARAMETERS >=[forms]![reports form]![DateFrom] And <=[forms]![reports
form]![DateTo] DateTime;
 
S

scubadiver

right then!

This SQL is a crosstab query based on a simple select query. In this select
query I have a date column called [RecWk] which also includes some
calculations. In the criteria for [RecWk] I have this
=[forms]![reports form]![DateFrom] And <=[forms]![reports form]![DateTo]

and it works fine.

In the cross-tab query I created a "where" field and inserted the criteria
and also inserted this into the parameter box and selected "date/time"


Jeff Boyce said:
How did you arrive at the SQL statement you posted? Can you give us a bit
more context?

That SQL statement starts out PARAMETERS <= ..., which will, if it works at
all, give you a yes/no, true/false "boolean" value. The end of your SQL
statement is DateTime, which attempts to set the value to a DateTime value.
Boolean <> DateTime.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

scubadiver said:
I don't understand the question. I don't do this much so an explanation
would be handy. Thanks


Jeff Boyce said:
What is the value of "PARAMETERS"? Your SQL statement seems to be
attempting to compare PARAMETERS to date values, which would give you a
Boolean (T/F), but you've given it DateTime data type.

--
Regards

Jeff Boyce
www.InformationFutures.net

Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/


I have looked at my SQL and changed the bracketing but now it says there
is
a syntax error in the parameter clause:

PARAMETERS >=[forms]![reports form]![DateFrom] And <=[forms]![reports
form]![DateTo] DateTime;
 
F

fredg

I have looked at my SQL and changed the bracketing but now it says there is
a syntax error in the parameter clause:

PARAMETERS >=[forms]![reports form]![DateFrom] And <=[forms]![reports
form]![DateTo] DateTime;

Are you talking about the first line of the SQL if you have entered
parameters in the parameter dialog box?
You're confusing the Parameter list with the Where clause.

Remove the <= and >= from the Parameter listing and show the DateTime
datatype for both parameters.

PARAMETERS [forms]![reports form]![DateFrom] DateTime,
[forms]![reports form]![DateTo] DateTime;
Select YourTable ..... etc....
Where YourTable.DateField Between [forms]![reports form]![DateFrom]
and [forms]![reports form]![DateTo]
 
S

scubadiver

Thanks Fred.


fredg said:
I have looked at my SQL and changed the bracketing but now it says there is
a syntax error in the parameter clause:

PARAMETERS >=[forms]![reports form]![DateFrom] And <=[forms]![reports
form]![DateTo] DateTime;

Are you talking about the first line of the SQL if you have entered
parameters in the parameter dialog box?
You're confusing the Parameter list with the Where clause.

Remove the <= and >= from the Parameter listing and show the DateTime
datatype for both parameters.

PARAMETERS [forms]![reports form]![DateFrom] DateTime,
[forms]![reports form]![DateTo] DateTime;
Select YourTable ..... etc....
Where YourTable.DateField Between [forms]![reports form]![DateFrom]
and [forms]![reports form]![DateTo]
 

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