Results 1 to 10 of 10
  1. #1
    vincentsp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    29

    DataDiff function error

    Hello,



    I'm new here and would like to thank you allready for all the information I obtained from this forum!
    Dispite all the information I'm simply not able to get my DataDiff function working without getting a error message
    Attached a screen shot.

    Click image for larger version. 

Name:	Screenshot.jpg 
Views:	11 
Size:	100.3 KB 
ID:	19411

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Your screen prints are two small to read.
    Can you post your formula?
    And then can you post a data sample that shows the value of the fields used in the formula?

  3. #3
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I can't read the error message text completely (but I can see it's a syntax error), or the expression you are using in the query -

    please post the query expression.

  4. #4
    vincentsp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    29
    The query expression I used is: =Datediff("n",[StartTime],[EndTime])
    My Fields are named "StartTime" and "EndTime" and are "Date/Time" data type

  5. #5
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    "My Fields are named "StartTime" and "EndTime" and are "Date/Time" data type"

    But they aren't called that. According to the screen shot, they are called TableBegin and TableEnd (I think).

    So the query expression should be: =Datediff("n",[TableBegin],[TableEnd])

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    The "equals" syntax is not a Access Query structure.
    You give your calculation an "alias" (or name), like:
    Code:
    Difference: Datediff("n",[StartTime],[EndTime])

  7. #7
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    JoeM -

    "The "equals" syntax is not a Access Query structure."
    That's what I thought too, and when I tried it, A2010 automatically removed the "=" and replaced it with "Expr1:". Very convenient.

  8. #8
    vincentsp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    29
    Thats something I tried already and somehow I keep getting the same error message.
    When I click "Ok" and confirm the error message it underlines the comma, marked in red in the example below.

    Difference: Datediff("n",[StartTime],[EndTime])

    Attached are some screenshots (in decent quality this time )

    Click image for larger version. 

Name:	Screenshot 1.jpg 
Views:	6 
Size:	119.3 KB 
ID:	19420Click image for larger version. 

Name:	Screenshot 2.jpg 
Views:	6 
Size:	135.1 KB 
ID:	19421

  9. #9
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Are you using an American version of Office, a European version, or some other version?
    I have seen some versions of Office use semi-colons instead of commas to separate arguments.

  10. #10
    vincentsp is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2015
    Posts
    29
    Problem solved!! just by replacing the commas in semicolons as JoeM mentioned.
    Thanks a lot! (I'm using a European version by the way)

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

Similar Threads

  1. Error - function not supported
    By Roger3322 in forum Queries
    Replies: 1
    Last Post: 10-21-2014, 09:59 AM
  2. Replies: 8
    Last Post: 01-31-2014, 01:45 PM
  3. Error with Replace Function
    By Juan4412 in forum Queries
    Replies: 1
    Last Post: 09-30-2012, 05:48 PM
  4. Error in Function
    By Alex Motilal in forum Programming
    Replies: 2
    Last Post: 10-11-2011, 06:30 AM
  5. aggregate error due to function
    By boutwater in forum Access
    Replies: 2
    Last Post: 09-26-2011, 03:39 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