Results 1 to 3 of 3
  1. #1
    joethall is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    9

    Date comparisons

    The follow line of SQL will work perfectly finding 300+ entriess


    but when it is executed it finds xero;

    SELECT * FROM tblComps WHERE (Active=True AND Year([DateCreated])=#2016#)

    The above text is assigned to the variable mySQL in VBscript and then executed with:

    mySQL = "SELECT * FROM tblComps WHERE (Active=True AND Year([DateCreated])=#2016#)"
    jRs.Open mySQL, jConn, 3, 3

    Can anyone explain this behavior?

    Thanks

    Joe

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Year may be numeric, you dont need the # sign.

  3. #3
    joethall is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    9
    It still finds zero records without the two double-quote marks !

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Date comparisons
    By scoe in forum Queries
    Replies: 4
    Last Post: 09-05-2014, 04:27 AM
  2. Nested IIF for two comparisons
    By aflamin24 in forum Access
    Replies: 3
    Last Post: 09-19-2012, 05:18 PM
  3. Replies: 3
    Last Post: 08-21-2012, 03:05 PM
  4. Weekly reporting comparisons in query
    By Schon731 in forum Queries
    Replies: 3
    Last Post: 10-21-2010, 06:59 PM
  5. Grouping from several comparisons
    By piflechien73 in forum Queries
    Replies: 3
    Last Post: 05-26-2009, 04:15 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums