Solved

ADO SELECT WHERE Date Between

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
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.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

816 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now