Results 1 to 3 of 3
  1. #1
    RayMilhon is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2011
    Southern California

    Yesterday Parameter not working

    I have a SQL Server 2008 Database. I need to run a query that pulls all records received Yesterday. This will be an automated report and I'm having an issue with the get date function

    The DateRECD field is a date time in the format 01/03/2020 00:00:00. I'm using the GetDate()-1 function to get the data but Getdate()'s Time portion is as of the time the query is run. How do I get GETDATE()-1 to return the date but lose the time or at least set the time to 00:00:00

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    The Great Land

    How to attach file: To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Anchorage, Alaska, USA
    Not sure how you are using the GETDATE() function (in SQLS or Access PT query)

    SELECT GETDATE(); ---> returns 2020-01-04 02:03:45.790

    in SQLS:
    SELECT GETDATE()-1; ---> returns 2020-01-03 01:58:35.230

    But these two seem to return just the date (in SQLS)

    in SQLS:
    SELECT CONVERT (date, GETDATE()-1); ---> returns 2020-01-03
    SELECT cast(GETDATE()-1 as date); ---> returns 2020-01-03
    "Veni, Vidi, Velcro"
    (I came; I saw; I stuck around.)

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

Similar Threads

  1. Replies: 7
    Last Post: 11-27-2019, 03:23 AM
  2. Replies: 2
    Last Post: 03-13-2014, 09:52 AM
  3. Between/And parameter not working
    By Lowell in forum Queries
    Replies: 4
    Last Post: 10-19-2012, 09:47 AM
  4. Replies: 6
    Last Post: 10-05-2012, 02:38 PM
  5. parameter query not working
    By denny in forum Access
    Replies: 3
    Last Post: 02-20-2011, 01:07 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
Tech Forums: Microsoft Office Forums