Chris__T
Posts: 339
|
| Posted: 03/26/2008, 9:56 AM |
|
Ok, so I'm trying to pull records that are 60 days past the current day (CurrentDate). In the VQB i put in the WHERE section:
Date_In_Table <= DateAdd("d",-60,current date)
that doesn't work. I also tried
Date_In_Table <= DateAdd("d",-60,"3/26/2008")
that doesn't work either.
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 03/26/2008, 10:31 AM |
|
I got it to work. First I stuck a hidden text box on the grid form and put the DateAdd code in there, setting it equal to the textbox. (Grid.Textbox.value)
Then in visual query builder, set Field as the date field from the table. Condition is "less than or equal to", then the Parameter is the hidden textbox and its type is set as "Form". It "works".
It's pulling all the data from the table. I think it has to do with trying to call a textbox value in the query. That form thing didn't work.
If you have a value in a textbox on the form, how can you implement that in your query (visual query builder)?
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 03/26/2008, 11:26 AM |
|
In VQB Where:
Condition Type :Expression
Expression: Date_In_Table <= Date_Add(Current_date, INTERVAL -60 DAY)
Should solve it directly in VQB MySQL version!!!
expose DB flavour.
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 03/26/2008, 12:48 PM |
|
Except I'm using MS Access
|
 |
 |
Chris__T
Posts: 339
|
| Posted: 03/26/2008, 12:58 PM |
|
Date_in_Table <= DateAdd("d", -60, date()) is a no go as well.
All of my attempts were in Condition Type: Expression as well.
|
 |
 |
wkempees
Posts: 1679
|
| Posted: 03/26/2008, 3:01 PM |
|
Quote Chris__T:
I got it to work. First I stuck a hidden text box on the grid form and put the DateAdd code in there, setting it equal to the textbox. (Grid.Textbox.value)
Then in visual query builder, set Field as the date field from the table. Condition is "less than or equal to", then the Parameter is the hidden textbox and its type is set as "Form". It "works".
It's pulling all the data from the table. I think it has to do with trying to call a textbox value in the query. That form thing didn't work.
If you have a value in a textbox on the form, how can you implement that in your query (visual query builder)?
As per your earlier post, that method is right, type = Form or Application, genereates a CCGetFromPost, possibly it is getting the right data, but the less equal is having problems with the date format (again).
Switch to debug or response.write or whichever method you use and expose the actual SQL.
(If in VQB press the SQL button or the result button.
Walter
_________________
Origin: NL, T:GMT+1 (Forumtime +9)
CCS3/4.01.006 PhP, MySQL .Net/InMotion(Vista/XP, XAMPP)
if you liked this info PAYPAL me: http://donate.consultair.eu
|
 |
 |
|