Results 1 to 5 of 5
  1. #1
    Jim.H. is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    16

    DateDiff in a query

    DateDiff in a query


    I am trying to calculate time difference between two time columns as follows in a query which has a few inner joins
    Diff: DateDiff("h",[Table1.TimeStrat],[Table1.TimeStrat])
    This gives problem, it is asking [Table1.TimeStrat] to be entered, where is the problem?

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Try without the brackets or

    [Table1].[TimeStrat]

    As it is, it thinks the whole bit is supposed to be a field name, and it can't find it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Jim.H. is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    16
    Quote Originally Posted by pbaldy View Post
    Try without the brackets or

    [Table1].[TimeStrat]

    As it is, it thinks the whole bit is supposed to be a field name, and it can't find it.
    Thank you. I removed the brackets, it turned into this.
    Diff: DateDiff("h",[Table1].[TimeStart],[Table1].[TimeEnd])
    It still asks me [Table1].[TimeStart], what am I missing here? This is query inner join many tables, would that have any impact?

  4. #4
    Jim.H. is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jan 2012
    Posts
    16
    Quote Originally Posted by Jim.H. View Post
    Thank you. I removed the brackets, it turned into this.
    Diff: DateDiff("h",[Table1].[TimeStart],[Table1].[TimeEnd])
    It still asks me [Table1].[TimeStart], what am I missing here? This is query inner join many tables, would that have any impact?
    Resolved. Spelling problem on the table. Thanks.

  5. #5
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    No problemo.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Query datediff error
    By RayMilhon in forum Queries
    Replies: 3
    Last Post: 10-05-2011, 12:13 PM
  2. DateDiff Missing Operator? Long Query
    By ewassmer in forum Queries
    Replies: 1
    Last Post: 08-25-2011, 10:46 AM
  3. How to use DateDiff?
    By teirrah1995 in forum Queries
    Replies: 10
    Last Post: 10-19-2010, 12:07 PM
  4. Datediff
    By greggue in forum Queries
    Replies: 2
    Last Post: 08-13-2010, 03:53 PM
  5. Query DateDiff calculation excluding weekends
    By Masterfinn in forum Queries
    Replies: 3
    Last Post: 04-01-2010, 09:46 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