Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    What do you mean by 'Query row'?



    The expression belongs on the Field row of query builder. This is to construct a field with expression.
    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.

  2. #17
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239

    Question

    Sorry, I meant to say "field row". Okay, I changed the syntax to:

    Minutes: DateDiff("n",[Coronary].[firstTime],[Coronary].[lastTime])

    it gives a table of values which (after a manual random check) appears to be correct until the value highlighted in red below. The record has firstTime (11:44pm) and lastTime (12:09am). What should I do to correct this?

    Minutes
    56
    -1415
    28

  3. #18
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    This range is crossing midnight to the next day? Without the date component, it reads 12:09am as 12:09am of the same day as 11:44pm. So 12:09am is before 11:44pm and will get weird results.

    If ranges will cross midnight and/or extend for multiple days, weeks, months, etc, need date component.
    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.

  4. #19
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    thanks but what do you mean by Date component

  5. #20
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    As in Date/Time type field.

    There is date component and time component.

    Need the MM/DD/YYYY parts.
    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.

  6. #21
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    the formula I know is: DateDiff("n",[Coronary].[firstTime],[Coronary].[lastTime])
    and the "n" indicates the output should be in minutes. Could you advise what the MM/DD/YYYY parts will be exactly and where it should be in this formula please? This is new for me. Thanks much

  7. #22
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    The MM/DD/YYYY must be in the data. If you do not have that data saved then solving this will be difficult.
    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.

  8. #23
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    hi June7, this is still not clear to me. In my table, date of records has format DD/MM/YYYYY. Am I supposed to put this into

    the formula DateDiff("n",[Coronary].[firstTime],[Coronary].[lastTime]) ???

  9. #24
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    The example data you show in post 17 has only time parts.

    If data is saved as full date/time, then the expression should work.
    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. #25
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    Now I'm super.

    One thing has nothing to do with the other. when you asked about the format, I thought you were referring to the record in whole and not that particular field. for the field in question, the input mask I have is 00:00;0;_

  11. #26
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239
    i.e. it should give an output of hh:mm

  12. #27
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    I am also confused. Do you have date in one field and time in another? The expression will have to combine these fields.

    Regardless of what you want to show, if you want DateDiff to work properly, need full date/time value. How is the calc supposed to know that 12:09 AM is the next day and not the same day as 11:44 PM? If the date is not provided, the calc will assume same day, resulting in a negative in this case.
    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.

  13. #28
    Sheba is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2014
    Posts
    239

    Exclamation

    in my table I have as many as 50 columns. Three of these columns are

    "tripDate"
    data type - date/time
    format - dd/mm/yyyy

    "firstTime"
    data type - date/time
    input mask - hh:mm

    "lastTime"
    data type - date/time
    input mask - hh:mm

  14. #29
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,954
    That does not help solve the issue of when firstTime and lastTime fall on different days. Need tripFirstDate and tripLastDate or maybe some code to determine if lastTime falls on following day. If firstTime is PM and lastTime is AM then lastTime must have been the next day, unless this range could extend for multiple days.
    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.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Cash Flow Analysis
    By cbh35711 in forum Access
    Replies: 15
    Last Post: 09-09-2014, 12:11 PM
  2. Tricky Analysis??
    By stumped in forum Queries
    Replies: 2
    Last Post: 09-13-2012, 01:59 AM
  3. Data Analysis Direction
    By canyon289 in forum Access
    Replies: 6
    Last Post: 03-05-2012, 11:51 PM
  4. Table Data Analysis
    By bdf48 in forum Programming
    Replies: 1
    Last Post: 12-01-2011, 02:21 PM
  5. Need Help with Queries-Trade Analysis
    By nybanshee in forum Queries
    Replies: 0
    Last Post: 03-08-2008, 11:50 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