Results 1 to 6 of 6
  1. #1
    Bosco is offline Novice
    Windows XP Access 2000
    Join Date
    Jun 2010
    Posts
    2

    Query Date without comparing time

    I have a datetime field in a table stored in Sql Server. I haev a access query that I am trying to allow a user to input a date and select all the records that correspond to that date.

    =[Beginning Date: 'mm/dd/yyyy']

    The problem is that the date the user types in is:

    06/24/2010

    But the date in the database has:

    06/24/2010 10:24:00:00

    So no records return.

    There has to be an easy way to query anything with just the date portion matching regardless of the time???



    Thanks for your help.....

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Use this in the query to modify your datetime field:

    Code:
    DateOnly: DateValue([yourdatetimefieldname])
    Cheers,

  3. #3
    Bosco is offline Novice
    Windows XP Access 2000
    Join Date
    Jun 2010
    Posts
    2
    Thanks....
    So I would just put

    = DateOnly: DateValue([Start Date] in the criteria field of the query column?

    I just want the user to enter a date and then only select records with that date.

    Thanks!!

  4. #4
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    You'd do something like this (I use Format([field], "Short Date") instead of DateValue([field]), but they both should work!).

  5. #5
    Rawb is offline Expert
    Windows XP Access 2000
    Join Date
    Dec 2009
    Location
    Somewhere
    Posts
    875
    Note: Use ConneXionLost's version of DateValue([field]).

    If you use my method, the data is treated as a text string and not an actual date. This can lead to funky sorting results.

  6. #6
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    If you're still having difficulty, post the SQL of your Access query.

    Cheers,

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

Similar Threads

  1. Comparing Date with current Date
    By ds_8805 in forum Forms
    Replies: 7
    Last Post: 03-31-2010, 09:31 PM
  2. Date and time in filename
    By frankesjoberg in forum Import/Export Data
    Replies: 1
    Last Post: 03-02-2010, 12:35 PM
  3. Date + Time = Date Time
    By TundraMonkey in forum Access
    Replies: 3
    Last Post: 07-02-2009, 09:30 PM
  4. Access Date/Time....I need a "generic" date.
    By beastmaster in forum Access
    Replies: 2
    Last Post: 12-29-2005, 12:55 PM
  5. date/time number
    By playfuljade in forum Forms
    Replies: 4
    Last Post: 12-19-2005, 12:52 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