Results 1 to 10 of 10
  1. #1
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121

    Days360 versus DatedIf versusDateDiff

    I get a different results with all three formulas as shown below, but my customer wants Days360 which is not in Access. Anyone know how to get to Days360 result in Access query?



  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    No formulas nor results shown.
    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.

  3. #3
    Cottonshirt is offline Competent Performer
    Windows 8 Access 2007
    Join Date
    Feb 2018
    Posts
    116
    Quote Originally Posted by smg View Post
    Anyone know how to get to Days360 result in Access query?
    there are a number of solutions given on this page.

    good luck with your project,



    Cottonshirt

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Followed those calcs and built VBA function. Gives same result as Excel.
    Code:
    Function Days360(dteStart As Date, dteEnd As Date)
    Days360 = ((Year(dteEnd) - Year(dteStart)) - 1) * 360 + ((12 - Month(dteStart)) * 30) + (30 - Day(dteStart)) + ((Month(dteEnd) - 1) * 30) + (Day(dteEnd))
    End Function
    

    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.

  5. #5
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121

    ays360 versus DatedIf versus DateDiff versus VBA function

    Attached is what I get for the VBA function as well as DateDiff, DatedIf and Days360. You will see that none of these match Days360 100%. Maybe this is the closest I can get? Or, any other ideas?
    Attached Files Attached Files

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    I ran into a similar issue attempting to translate Excel cell formulas into Access VBA. Calcs involved matrix multiplication. I compared cell formula calcs with running Excel functions in VBA as well as strictly VBA. Got 3 different output.
    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.

  7. #7
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121
    Thank you for you assistance, I will have to let my customer know he has to pick one of the three in access.

  8. #8
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121
    how do I get a query to use this function?

  9. #9
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,892
    Which function?

    Put VBA custom function in a general module. Then it can be called in query.
    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.

  10. #10
    smg is offline Competent Performer
    Windows XP Access 2010 64bit
    Join Date
    Apr 2019
    Posts
    121
    Great, thanks

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

Similar Threads

  1. DateDif calculation
    By ssworthi in forum Queries
    Replies: 2
    Last Post: 06-02-2015, 11:58 AM
  2. One database versus multiple databases
    By jhanson2 in forum Database Design
    Replies: 5
    Last Post: 02-18-2015, 12:43 AM
  3. weekdays versus weekend
    By webisti in forum Access
    Replies: 6
    Last Post: 09-10-2013, 02:27 AM
  4. VBA Versus Macro
    By RapidRepairArnold in forum Programming
    Replies: 3
    Last Post: 02-04-2013, 05:38 PM
  5. dlookup versus SQL value search
    By marianne in forum Access
    Replies: 3
    Last Post: 07-15-2009, 09:23 AM

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