Parameterized query syntax

  • Thread starter Thread starter RipperT
  • Start date Start date
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
 
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.
 
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.
 
Back
Top