Query based on text box value?

MikeDuffield

Registered User.
Local time
Today, 07:44
Joined
Aug 31, 2010
Messages
50
Hi guys & girls,

Doing a fairly simple thing here which I'm sure I've almost cracked, however no matter what I've tried I've not had any luck. Searching didn't shed much light either.

I have the following SQL:

Code:
WHERE DATEDIFF('d'.startdate,enddate) > 0

The idea is to have startdate and enddate filled in by two text boxes on a form. Let's say that the form is called "reportfrm" and the boxes are called "fromtxt" and "totxt".

Can anyone help?

(I'm used to VB, where it would just be a case of me.totxt.value, I'm not so confident in SQL...)


Thanks in advance.
Mike.
 
Is that a typo or is that what you actually have in your SQL statement..
Code:
WHERE DATEDIFF('d'.startdate,enddate) > 0
If that is what you have then replace the . (dot) with a , (comma)
Code:
WHERE DATEDIFF('d'[COLOR=Red][B],[/B][/COLOR]startdate,enddate) > 0
 
Thanks, that was a typo - fixed it.

Any idea on the text box linking?
 
You mean to say that the "startdate" and "enddate" are to be fed into the query by the "reportfrm"??
 
All you have to do is.. something like..
Code:
WHERE DateDiff("d",[Forms]![reportfrm]![startdate],[Forms]![reportfrm]![enddate])
 

Users who are viewing this thread

Back
Top Bottom