Solved

ADO SELECT WHERE Date Between

Posted on 2010-09-03
7
1,018 Views
Last Modified: 2012-05-10
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
Comment
Question by:thenemesiz
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 4

Accepted Solution

by:
gozoliet earned 250 total points
ID: 33597434
dtEnd = Date & " 11:59:99 PM"

should be 11:59:59 PM
0
 
LVL 47

Assisted Solution

by:Dale Fye (Access MVP)
Dale Fye (Access MVP) earned 250 total points
ID: 33597461
strSQL = "SELECT * FROM Tiko " _
            & "WHERE T_Date BETWEEN #" & Date() & "# and #" & Date() + .999 & "# " _
            & "ORDER BY T_Date"

0
 

Author Comment

by:thenemesiz
ID: 33597587
so, it was that **11:59:59 PM** all along...thanks gozoliet

...both solutions work!

thanks
0
 
LVL 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 33597706
If both solutions work, I have no objection to your reopening the question and splitting the points.
0
 

Author Comment

by:thenemesiz
ID: 33609109
modus_in_rebus,

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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question