Reply
using between for date range
Old 03-20-2008, 10:20 AM using between for date range
ChipJohns's Avatar
I don't know! Do you?

Posts: 477
Name: Chip Johns
Location: Savannah Georgia
Ok,
I've racked my brain. Tried to figure this out.. Help...!

Trying to figure out how to retrieve info within a date range. Here is what I'm doing

Code:
Dim dDateFrom
dDateFrom=FormatDateTime(1/1/2008,2) 
Dim dDateTo
dDateTo=FormatDateTime(1/20/2008,2)
 
strQ1 = "SELECT *"
strQ1 = strQ1 & " FROM smeTracking"
strQ1 = strQ1 & " WHERE smTrDate BETWEEN " & dDateFrom & " AND " & dDateTo
strQ1 = strQ1 & " ORDER BY smTrDate"
strQ1 = strQ1 & ";"
objRS1.Open strQ1
No Errors. Just no results...

What's interesting is that when I change to NOT BETWEEN... All the records show.!?

What am I missing here!?


Thanks for any assistance.

CHip

Last edited by ChipJohns : 03-20-2008 at 10:21 AM.
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
When You Register, These Ads Go Away!
     
Old 03-20-2008, 12:30 PM Re: using between for date range
ChipJohns's Avatar
I don't know! Do you?

Posts: 477
Name: Chip Johns
Location: Savannah Georgia
And it works!

Code:
Dim dDateFrom
dDateFrom=#01/21/2008# 
Dim dDateTo
dDateTo=#01/25/2008#
strQ1 = "SELECT *"
strQ1 = strQ1 & " FROM smeTracking"
strQ1 = strQ1 & " WHERE smTrDate>=#" &  dDateFrom
strQ1 = strQ1 & "#" & " AND smTrDate<=#" & dDateTo
strQ1 = strQ1 & "# ORDER BY smTrDate"
strQ1 = strQ1 & ";"
objRS1.Open strQ1
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 03-21-2008, 02:28 AM Re: using between for date range
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,024
Name: Forrest Croce
Location: Seattle, WA
Microsoft Access?
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 03-21-2008, 08:51 AM Re: using between for date range
ChipJohns's Avatar
I don't know! Do you?

Posts: 477
Name: Chip Johns
Location: Savannah Georgia
YES!

How did you know
ChipJohns is offline
Reply With Quote
View Public Profile Visit ChipJohns's homepage!
 
Old 03-21-2008, 12:24 PM Re: using between for date range
chrishirst's Avatar
Super Moderator

Posts: 12,651
Location: Blackpool. UK
He's a mind reader
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 03-21-2008, 02:58 PM Re: using between for date range
Learning Newbie's Avatar
Moderator

Posts: 4,880
Name: John Alexander
Frosty is always reading my mind. I wish he'd stop. I think he got my ATM PIN number.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to using between for date range
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13297 seconds with 13 queries