Solved

ADO SELECT WHERE Date Between

Posted on 2010-09-03
7
1,020 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 48

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 48

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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

688 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