Results 1 to 3 of 3
  1. #1
    SgtSaunders69 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    17

    Query Criteria not returning any records


    I have a 2010 database using tables linked (ODBC) to a SQL database. Table dbo_tasks has a time/date field with much data populated. When I open the table in DATASHEET view and using the built in MSAccess data filter tool select "EQUALS" and copy paste or type an exact date from data in the table (EXAMPLE: 9/16/2011 4:14:20 PM) into the CUSTOM FILTER box and click OK no data is returned. If I perform the same steps on a non-time data field I can get data returned. Any thoughts on wh the fiilters will not return data for the DATE/TIME field?

    I can get the query to return dates if I use the criteria <#1/6/2009#. So my question then is .. how do I pass the date criteria in this format from a form text box to the criteria for the query. The method I've tried is to put =[forms]![formname]![fieldname] in the criteria field of the query, but how do I include / pass the required # syntax around the date criteria value to the query criteria? I've tried variations of =#[forms]![formname]![fieldname]#... but this does not work. What am I missing?

    Thanks..
    Last edited by SgtSaunders69; 12-20-2011 at 09:28 AM.

  2. #2
    hertfordkc is offline 18 year novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    481
    A guess: Since you are able to filter on other fields, you may be neglecting some syntax requirements, e.g. use of # to delimit date values. I'm not sure the filter tool guarantees that syntax requirements are met.

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,898
    The built-in filter tool should deal with any syntax requirements. The # delimiter would be needed in an SQL query statement.

    Unfortunately, I don't work with SQL database so can't speak to any compatibility issue for date values between Access and SQL.

    Sgt, you say a date field without time part will work?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-25-2011, 11:38 PM
  2. Replies: 1
    Last Post: 09-20-2011, 03:23 PM
  3. Recordset not returning records
    By TinaCa in forum Programming
    Replies: 3
    Last Post: 08-03-2011, 09:26 AM
  4. Replies: 1
    Last Post: 05-19-2011, 10:55 PM
  5. Returning multiple records Isn't what I need
    By frobro390 in forum Queries
    Replies: 6
    Last Post: 09-21-2010, 06:24 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