Parameterized query syntax

R

RipperT

Hello,

I am trying to write a parameterized query but can't get the syntax right. I
want the query to return all records containing a date exactly 14 days prior
to the date the user types in the parameter box. This isn't working:

WHERE (((tblCharges.AdSegDate)=[Enter Date:] -14));

An error message says the expression is typed incorrectly or is too
complicated to be evaluated.

Help!

Many thanx,

Rip
 
F

fredg

Hello,

I am trying to write a parameterized query but can't get the syntax right. I
want the query to return all records containing a date exactly 14 days prior
to the date the user types in the parameter box. This isn't working:

WHERE (((tblCharges.AdSegDate)=[Enter Date:] -14));

An error message says the expression is typed incorrectly or is too
complicated to be evaluated.

Help!

Many thanx,

Rip

In a Select Query?
This is one of the times you must enter the parameter prompt in the
Parameters dialog box so that Access recognizes the entered data's
datatype as DateTime.

In Design view click on Query + Parameters
Write
[Enter Date:] in the left column and Date/Time in the right column.

Make sure you include the brackets and that it is spelled exactly the
same as the criteria prompt.
The above is ALWAYS necessary in a Crosstab query.
 
R

RipperT

Outstanding. Many thanks.

Rip

--
Ripper T Smith
rippertsmith<nospam>@comcast.net
fredg said:
Hello,

I am trying to write a parameterized query but can't get the syntax
right. I
want the query to return all records containing a date exactly 14 days
prior
to the date the user types in the parameter box. This isn't working:

WHERE (((tblCharges.AdSegDate)=[Enter Date:] -14));

An error message says the expression is typed incorrectly or is too
complicated to be evaluated.

Help!

Many thanx,

Rip

In a Select Query?
This is one of the times you must enter the parameter prompt in the
Parameters dialog box so that Access recognizes the entered data's
datatype as DateTime.

In Design view click on Query + Parameters
Write
[Enter Date:] in the left column and Date/Time in the right column.

Make sure you include the brackets and that it is spelled exactly the
same as the criteria prompt.
The above is ALWAYS necessary in a Crosstab query.
 

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