Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1024
  • Last Modified:

ADO SELECT WHERE Date Between

I am getting a 'Syntax error in date in query expression' for the following SELECT stmt:

strSQL = "SELECT * FROM Tiko WHERE T_Date BETWEEN #"
strSQL = strSQL & dtStart & "# and #"
strSQL = strSQL & dtEnd & "# ORDER BY T_Date"

dtStart = Date & " 00:00:00 AM"
dtEnd = Date & " 11:59:99 PM"

Please help!!
thanx


0
thenemesiz
Asked:
thenemesiz
  • 2
  • 2
2 Solutions
 
gozolietCommented:
dtEnd = Date & " 11:59:99 PM"

should be 11:59:59 PM
0
 
Dale FyeCommented:
strSQL = "SELECT * FROM Tiko " _
            & "WHERE T_Date BETWEEN #" & Date() & "# and #" & Date() + .999 & "# " _
            & "ORDER BY T_Date"

0
 
thenemesizAuthor Commented:
so, it was that **11:59:59 PM** all along...thanks gozoliet

...both solutions work!

thanks
0
 
Dale FyeCommented:
If both solutions work, I have no objection to your reopening the question and splitting the points.
0
 
thenemesizAuthor Commented:
modus_in_rebus,

sorry about the points...am new here. How do I reopen the question?
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now