|
| |
|
|
pd_it_guy
Posts: 172 Joined: 3/4/2008 Status: offline
|
date troubles - 6/18/2008 15:13:43
Ok I have been at this for a couple of hours now and I am going exactly nowhere. The database has a field called into_pd which is a date. It is designated within the .mdb as a date/time field and no matter what variant the users input as a date, it ends up in the .mdb in a good format, all leading zeros lopped. Now I want to get all the records between 2 dates I select. The dates come from another form and as user input can be input any which way. The Query to get only the right dates is the problem. WHERE into_pd>='::start_date::' AND into_pd<='::end_date::' causes a type mismatch WHERE into_pd>=::start_date:: AND into_pd<=::end_date:: fixes the type mismatch error, but returns nothing when I know there are records between those dates. If I pull off one of the operators I do get some records returned but the comparison is not on the actual date value, but something else. It is not doing a date evaluation or doesnt see it as a date. What am I doing wrong here.
|
|
|
|
DesiMcK
Posts: 445 Joined: 4/26/2004 From: Essex, UK Status: offline
|
RE: date troubles - 6/18/2008 17:13:57
try WHERE into_pd>=#" & Request("start_date") & "# AND into_pd<=#" & Request("end_date") & "#" Desi
|
|
|
|
pd_it_guy
Posts: 172 Joined: 3/4/2008 Status: offline
|
RE: date troubles - 6/18/2008 17:40:16
Thanks for the response. I came across the DATEVALUE function and it seems to convert everything to a common denominator and thereby makes it work, thus: WHERE datevalue(into_pd) BETWEEN datevalue('::start_date::') AND datevalue('::end_date::') Someone please tell me if I am making a grave error with this code. If so or if it fails I will keep the suggested lines as well. This was my first time dealing with dates in Access, all the other date manipulation stuff was in Informix, which gives you a date and that's all.
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|