Results 1 to 3 of 3
  1. #1
    williamr is offline Novice
    Windows 10 Office 365
    Join Date
    Feb 2022
    Posts
    4

    How to total horizontally vs vertically

    I have a table with 5 fields, a date and 6 currency fields. For each record I want to total the money spend. Like 02/02/2022 100-50-200-300-500-150. A field with 1300 I can total, say 12 records vertically for each field but can seem to make it work for each record.

    Thanks


    DKWID (Don't know what I'm doing)

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Arithmetic. F1 + F2 + F3 + F4 + F5 + F6.

    However, arithmetic with Null returns Null. If any field is Null the expression will return Null. Can deal with null using Nz().

    Nz(F1,0)
    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
    Join Date
    Apr 2017
    Posts
    1,792
    This looks suspiciously like an Excel table ported into Access database!

    Try instead a table structure like (I assume the date is unique in your table, so every combination of EntryDate and EntryType is unique):
    EntryID, EntryDate, EntryType, Amount, where Entrytype determines, with which currency field in your current design the entry matches.
    Using your example data:
    1, 02/02/2022, 1, 100
    2
    , 02/02/2022, 2, 50
    3, 02/02/2022, 3, 200
    4, 02/02/2022, 4, 500
    5, 02/02/2022, 5, 150

    Now, total of every EntryDate will be calculated as
    Code:
    SELECT EntryDate, SUM(Amount) As EntrySum GROUP BY EntryDate
    Total of any combination of EntryType's will be calculated as:
    Code:
    SELECT EntryDate, SUM(Amount) As EntrySum WHERE EntryType IN (TypeLis) GROUP BY EntryDate
    like
    SELECT EntryDate, SUM(Amount) As EntrySum WHERE EntryType IN (1) GROUP BY EntryDate
    or
    SELECT EntryDate, SUM(Amount) As EntrySum WHERE EntryType IN (1,3,6) GROUP BY EntryDate
    And forget about rows! In Access it is practically an undetermined value! In your example, you have date as ID, and in which row this date is displayed depends on lot of conditions!

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

Similar Threads

  1. Replies: 3
    Last Post: 08-08-2015, 09:19 PM
  2. Center text vertically
    By kuku202 in forum Reports
    Replies: 1
    Last Post: 02-07-2015, 05:27 AM
  3. Replies: 7
    Last Post: 10-18-2012, 12:49 PM
  4. Replies: 4
    Last Post: 05-25-2012, 09:43 AM
  5. Can labels run vertically or at an angle?
    By ortley77 in forum Reports
    Replies: 5
    Last Post: 08-24-2010, 01:25 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