Results 1 to 4 of 4
  1. #1
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402

    dsum with criteria Not like 38,39,40,41

    Hi Guys



    i have a form with loads of unbound text fields on it, each field has code like this behind it


    =Nz(DSum("[payment]","[Account Transactions]","[category]=3 and [Entry Date] between #" & Format([Forms]![Open Balance Sheet]![Start Date Txt Box],"mm\/dd\/yyyy") & "# And #" & Format([Forms]![Open Balance Sheet]![End Date Txt Box],"mm\/dd\/yyyy") & "#"),0)


    in a unbound text box im trying to show the following

    basically what i am trying to do is to add up all the transactions with ids from 1 to 77 and then subtracting all the values from the same table where the category ID = 38,39,40,41

    is there a way to simplify this process?

    any help would be great

    Steve

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Could you just add the transactions with ids from 1-77 where category NOT In (38,39,40,41)?

  3. #3
    sdel_nevo is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2013
    Location
    Gloucester, UK
    Posts
    402
    hi orange

    i was struggling with the syntax,

    -Nz(DSum("[payment]","[Account Transactions]","[category] not '38,39,40,41' and [Entry Date] between #" & Format([Forms]![Open Balance Sheet]![Start Date Txt Box],"mm\/dd\/yyyy") & "# And #" & Format([Forms]![Open Balance Sheet]![End Date Txt Box],"mm\/dd\/yyyy") & "#"),0)


    used this as suggested and its working

    -Nz(DSum("[payment]","[Account Transactions]","[category] not in(38,39,40,41) and [Entry Date] between #" & Format([Forms]![Open Balance Sheet]![Start Date Txt Box],"mm\/dd\/yyyy") & "# And #" & Format([Forms]![Open Balance Sheet]![End Date Txt Box],"mm\/dd\/yyyy") & "#"),0)

    mate i take my hat of to you.

    many thanks

    Steve

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726

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

Similar Threads

  1. Dsum criteria
    By bdaniel in forum Queries
    Replies: 4
    Last Post: 11-27-2011, 03:41 PM
  2. Dsum criteria problem
    By leonhuynh2006 in forum Queries
    Replies: 3
    Last Post: 10-04-2011, 03:18 AM
  3. DSum criteria using a variable that has been defined
    By beanhead0321 in forum Programming
    Replies: 5
    Last Post: 07-24-2011, 09:57 PM
  4. How to use a create a DSum with multiple criteria
    By FlyingDisc in forum Reports
    Replies: 1
    Last Post: 01-05-2011, 08:31 PM
  5. DSUM with date criteria from form
    By krutoigoga in forum Reports
    Replies: 4
    Last Post: 07-28-2010, 01:32 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