Results 1 to 6 of 6
  1. #1
    doddiah is offline Novice
    Windows 8 Access 2007
    Join Date
    Jul 2015
    Posts
    5

    Dsum

    I have a from which has a sub Form in it which uses a query of a table which is filtered, In the main form I want a sum of the data in the subform for a particular field if TRUE.


    In the main form I have a text field with the Syntax =DSum("[Cost]","RepairInformation","[Labour] =.True."), but this returns an error, I have no issues for the total cost for with I have a Text Box in the subform which returns the Total cost in the main form.

    What are my options to have a conditional sum for a particular condition.

    Thanks


    Regards

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Remove the periods in the Dsum. .true.
    the TRUE goes outside the quotes.
    "labor=" & true
    or
    Build a query that sums only TRUE values. Have a subForm for this qry.

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Why does the True need to go outside the quotes? Fixed values like that I leave inside.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    I guess it can work Inside as well. True is true.

  5. #5
    doddiah is offline Novice
    Windows 8 Access 2007
    Join Date
    Jul 2015
    Posts
    5

    Dsum

    Thanks,

    I am a novice, but am able to handle other stuff but DSUM and DCount never work for me. Would it be better I used a Dynaset of the query of the sub-from and if so in that case what will be the syntax to make use of the record source of the sub-form

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Did you try taking the periods out?

    =DSum("[Cost]","RepairInformation","[Labour] =True")
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. DSum
    By balajigade in forum Queries
    Replies: 1
    Last Post: 04-26-2015, 10:26 AM
  2. Sum or Dsum or........VBA
    By BLFOSTER in forum Programming
    Replies: 7
    Last Post: 04-28-2014, 03:53 PM
  3. Help with Sum and DSum
    By objNoob in forum Reports
    Replies: 5
    Last Post: 12-05-2011, 01:55 AM
  4. How do I use the DSum
    By Ironclaw in forum Access
    Replies: 1
    Last Post: 08-25-2010, 07:35 AM
  5. Help with dsum
    By bjsbrown in forum Reports
    Replies: 6
    Last Post: 02-06-2010, 09:33 AM

Tags for this Thread

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