DATEDIFF function problem

W

WB

The expected results of a query using the datediff function as part of the
criteria is causing a problem

This works properly: DateDiff("d",t3.TransactionDate, now()) > 150

This doesn't work properly: DateDiff("d",t3.TransactionDate, now()) >
[Enter Days]


Does anyone have information on why there is a difference?

Thanks in advance
WB
 
W

Wayne Morgan

I suspect that Access/Jet is guessing wrong about the data type of [Enter
Days]. Try specifying by adding the following line to the start of the SQL
view (i.e. prior to SELECT ....)

PARAMETERS [Enter Days] Short;
or
PARAMETERS [Enter Days] Long;

The options are for an Integer or Long Integer data type. You can also do
this in Design view by going to Query|Parameters... and typing in [Enter
Days] under the Parameter column and picking a data type.
 
W

WB

Thanks, worked perfect.
Wayne Morgan said:
I suspect that Access/Jet is guessing wrong about the data type of [Enter
Days]. Try specifying by adding the following line to the start of the SQL
view (i.e. prior to SELECT ....)

PARAMETERS [Enter Days] Short;
or
PARAMETERS [Enter Days] Long;

The options are for an Integer or Long Integer data type. You can also do
this in Design view by going to Query|Parameters... and typing in [Enter
Days] under the Parameter column and picking a data type.

--
Wayne Morgan
MS Access MVP


WB said:
The expected results of a query using the datediff function as part of the
criteria is causing a problem

This works properly: DateDiff("d",t3.TransactionDate, now()) > 150

This doesn't work properly: DateDiff("d",t3.TransactionDate, now()) >
[Enter Days]


Does anyone have information on why there is a difference?

Thanks in advance
WB
 

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

Similar Threads


Top