Results 1 to 5 of 5
  1. #1
    Eranka is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    150

    Combine Code

    Code 1

    Code:
    IIf([Work_Type]="I",(Format((CStr(Fix(Sum([Expr7]))*24+Hour(Sum([Expr7])))),"00")),0)
    Code 2

    Code:
    IIf([Work_Type]="I",(Right("0" & CStr(Minute(Sum([Expr7]))),2)),0)
    Hi can anyone help me to combine above two codes

  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,929
    Show sample data and the desired 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.

  3. #3
    Eranka is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Dec 2017
    Posts
    150
    Hi

    i'm trying to sum the time which can be less than or greater than 24hrs. So here i'm calculating the hours and minutes separately.

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    time cannot be greater than 24 hours - if the sum is greater than 24 hours you will get days and time

    suggest show some example data

    Also, looks like you are not aware of how time and dates are stored - they are stored as doubles



    ?now()
    15/10/2020 09:36:13
    ?cdbl(now())
    44119.4001851852


    the time element is the bit after the decimal point and is the number of seconds today divided by 86400 which is the number of seconds in a day.

  5. #5
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi all!

    Eranka,

    give a try to this code:
    Code:
    IIf([Work_Type]="I",Int(Sum([Expr7])*24) & Format(Sum([Expr7]),"\:nn"),0)

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

Similar Threads

  1. How to combine 3 table into 1
    By phuduong in forum Queries
    Replies: 10
    Last Post: 10-20-2020, 08:49 PM
  2. Combine Code
    By Thompyt in forum Programming
    Replies: 7
    Last Post: 11-19-2016, 05:42 PM
  3. Replies: 1
    Last Post: 09-22-2016, 02:37 AM
  4. Replies: 5
    Last Post: 08-29-2016, 04:33 AM
  5. Code to combine report filter and date range
    By rhubarb in forum Reports
    Replies: 17
    Last Post: 10-28-2011, 03:08 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