Parametric searches with DateDiff

A

Amin

I have two time fields called [TimeField] and [Create Time Field]. I
calcualte the difference between the two times in minutes with:
DATEDIFF("n",[Create Time Field],[TimeField]))

Now, what I want to do is have a paramteric search, where the user inputs a
time frame, and it returns the records which meet that criteria. For example

DATEDIFF("n",[Create Time Field],[TimeField]))<[TimeFrame]

So the user would enter 75 (for 75 minutes) and it would return the records
that meet that criteria. However, this is not working. When I run the above
as a parametric search, it returns 196 records. When I input the value
directly into the code, like this

DATEDIFF("n",[Create Time Field],[TimeField]))<75

it returns 86 records. I don't know why it does this. Can anyone help?

Thanks in advance,
Amin
 
M

MGFoster

Amin said:
I have two time fields called [TimeField] and [Create Time Field]. I
calcualte the difference between the two times in minutes with:
DATEDIFF("n",[Create Time Field],[TimeField]))

Now, what I want to do is have a paramteric search, where the user inputs a
time frame, and it returns the records which meet that criteria. For example

DATEDIFF("n",[Create Time Field],[TimeField]))<[TimeFrame]

So the user would enter 75 (for 75 minutes) and it would return the records
that meet that criteria. However, this is not working. When I run the above
as a parametric search, it returns 196 records. When I input the value
directly into the code, like this

DATEDIFF("n",[Create Time Field],[TimeField]))<75

it returns 86 records. I don't know why it does this. Can anyone help?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Have you defined the parameter as a long or integer data type? If not
do this:

1. On the query's main menu bar (at top of screen) select:

Query > Parameters.

2. In the Parameters dialog box enter the name of the parameter:
TimeFrame.
3. Enter the data type as long or integer.
4. Test the query.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)
** Respond only to this newsgroup. I DO NOT respond to emails **

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBScA2eYechKqOuFEgEQJobwCggBGkaIAFPNJCcW1Kf0buRy2SyeEAoNVH
7cWN96r2UxEgAa6KBd61/42w
=LMNT
-----END PGP SIGNATURE-----
 

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

Time questions with partition 9
Setting the display format of a query using the DateDiff function 6
DateDiff question 1
Summing Time 4
DateDiff 4
No results using DateDiff 5
Can't query DateDiff 0
DateDiff 2

Top