Results 1 to 8 of 8
  1. #1
    MarkF2004 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    6

    DateDiif Query returns blank data?

    Hello there

    I am trying to calculate the number of days between two dates in a very basic access database and I think I followed the instructions properly but clearly have omitted a key element somewhere.

    This is the code I have entered: Days Supported: DateDiff("d",[Date_Closed],[Date_Referral_Received])

    NB I have tried swapping the two columns in the square brackets around but the same outcome is reached. I.e. the column for 'Days Supported' is completely blank.

    I tried posting a screenshot of the design screen but I am not sure I have permission to do that as yet.

    I shall continue checking prior suggestions but if anyone can see what I have done incorrectly and can repoint me, that would be great. Please ask if any further info is needed.

    Kind regards



    Mark

  2. #2
    MarkF2004 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    6
    Click image for larger version. 

Name:	Access Image.png 
Views:	13 
Size:	13.1 KB 
ID:	27261Aha... I found the way... this may help.

  3. #3
    MarkF2004 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    6
    And this is what the outcome looks like...
    Click image for larger version. 

Name:	Access Image 2.png 
Views:	13 
Size:	35.0 KB 
ID:	27262

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    More info on DateDiff

    Are you sure there are valid dates in [Date_Closed] [Date_Referral_Received]

    OOps: I think we were posting at the same time.

  5. #5
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Switch the dates:

    Days Supported: DateDiff("d", [Date_Referral_Received], [Date_Closed])

  6. #6
    MarkF2004 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    6
    Hi again and thank you for the responses,

    When you say "switch the dates around", do you mean just in the formula or actually swap the columns? I have tried the formula in both ways but both times it is blank. I wondered if the date format in the columns was inputted incorrectly? (I am inputting in British format, would the US format make a difference?)

    I will be persevering with this over the weekend so I am grateful for your assistance.

  7. #7
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,474
    Think it is that Date Closed format. Try this:

    Days Supported: DateDiff("d",[Date_Referral_Received],DatePart("m",[Date_Closed]) & "/" & DatePart("d",[Date_Closed]) & "/" & DatePart("yyyy",[Date_Closed]))

  8. #8
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    I'm seeing Date_Referral_Received in the post, and Date Referral Received in the image?? Same for Date_Closed.
    The date order will only affect the sign (+ or-), not produce no results.
    I'm also seeing special characters in field names (?) - a big no-no! Not to mentions spaces as well...
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Replies: 9
    Last Post: 07-27-2015, 01:19 PM
  2. Adding existing field to query returns blank
    By kaitlinquinn in forum Queries
    Replies: 5
    Last Post: 04-23-2014, 02:43 PM
  3. Update query to change field data to blank
    By xtrareal22 in forum Queries
    Replies: 3
    Last Post: 12-11-2013, 05:17 PM
  4. Replies: 9
    Last Post: 11-01-2013, 11:56 AM
  5. Replies: 1
    Last Post: 09-05-2008, 12: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
  •  
Other Forums: Microsoft Office Forums