Results 1 to 2 of 2
  1. #1
    taahir321 is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2011
    Posts
    4

    Problem to sum() a column containing an expression

    Hi,

    The following code works well in a text box controle in detail section of a report:



    IIf([StrM]>[EndM],IIf([StrH]>[EndH],(((24*([EndDate]-[StrDate]))-(([StrH]-[EndH]))-1)),(24*([EndDate]-[StrDate]))+(([EndH]-[StrH]))-1) & "." & (60-([StrM]-[EndM])),IIf([StrH]<[EndH],(((24*([EndDate]-[StrDate]))+([EndH]-[StrH]))),(24*([EndDate]-[StrDate]))-([StrH]-[EndH])) & "." & ([EndM]-[StrM]))

    But when this column is totalled using expression given below:

    =Sum(IIf([StrM]>[EndM],IIf([StrH]>[EndH],(((24*([EndDate]-[StrDate]))-(([StrH]-[EndH]))-1)),(24*([EndDate]-[StrDate]))+(([EndH]-[StrH]))-1) & "." & (60-([StrM]-[EndM])),IIf([StrH]<[EndH],(((24*([EndDate]-[StrDate]))+([EndH]-[StrH]))),(24*([EndDate]-[StrDate]))-([StrH]-[EndH])) & "." & ([EndM]-[StrM])))


    it gives error #error.

    Please help me out. I could not solve this problem for the last 2 weeks.


    Best regards,


    Tahir

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Can you post your DB here with some instructions on exactly what you are doing when you get the error?
    If I can reproduce the error I will try & help.

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

Similar Threads

  1. Replies: 1
    Last Post: 08-18-2011, 08:35 AM
  2. Problem with cross tab on column heading
    By pascal_22 in forum Queries
    Replies: 0
    Last Post: 12-01-2010, 08:00 AM
  3. Replies: 1
    Last Post: 04-15-2010, 02:07 AM
  4. Sum problem for query expression
    By Stanggirlie in forum Access
    Replies: 3
    Last Post: 09-18-2009, 05:54 AM
  5. inserting values in column based another column
    By wasim_sono in forum Database Design
    Replies: 1
    Last Post: 06-27-2006, 05: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