Solved

ADO SELECT WHERE Date Between

Posted on 2010-09-03
7
1,016 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
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.

840 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