Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Is the LineItem field text? Must be to have that one value in it. If so try

    DSum("[LICost]","SubQ2","[LineItem] <= '" & [LineItem] & "'")



    but watch out, as with a text field you get an alphabetic comparison (100 is less than 2).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    mittra is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2014
    Posts
    17
    It took a little finnagling, but I got the thing working. Instead of putting the DSUM into a subquery, I saved that portion out as it's own separate query and put that query as the from part of the SQL statement. So in the end it looks like this:

    SELECT SubQ3.LineItem
    FROM (SELECT qrySubQ2.LineItem, qrySubQ2.LICost, qrySubQ2.LIMustDo, qrySubQ2.LIScore, DSum("[LICost]","qrySubQ2","[LineItem] <= " & [LineItem]) *1 AS LITotal
    FROM qrySubQ2
    GROUP BY qrySubQ2.LineItem, qrySubQ2.LICost, qrySubQ2.LIMustDo, qrySubQ2.LIScore
    ORDER BY qrySubQ2.LIMustDo, qrySubQ2.LIScore DESC) AS SubQ3
    WHERE (((SubQ3.LITotal)<=([AvailFunds])*1));

    Thanks for your help better understanding the DSUM statement!

  3. #18
    mittra is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2014
    Posts
    17
    Quote Originally Posted by pbaldy View Post
    Is the LineItem field text? Must be to have that one value in it. If so try

    DSum("[LICost]","SubQ2","[LineItem] <= '" & [LineItem] & "'")

    but watch out, as with a text field you get an alphabetic comparison (100 is less than 2).
    Turns out LineItem was text. We had to break out the Projects into a subtable and grab the first LineItem # to put in the LineItem field so they would all stay numbers and would keep them in order. Made it tricky to break back out in the end, but we've got it working now.

  4. #19
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,643
    Glad you got it working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Too Few Parameters. Expected 1
    By flamesofdoom in forum Programming
    Replies: 1
    Last Post: 02-15-2013, 02:23 PM
  2. too few parameters; expected 2
    By slimjen in forum Forms
    Replies: 13
    Last Post: 07-26-2012, 02:42 PM
  3. issues with DSum
    By ozdemirozgur in forum Access
    Replies: 3
    Last Post: 05-08-2011, 02:48 PM
  4. Too few parameters expected 4
    By forestgump in forum Programming
    Replies: 1
    Last Post: 04-15-2011, 09:10 AM
  5. Too few parameters. Expected 2.
    By PPCMIS2009 in forum Access
    Replies: 0
    Last Post: 01-28-2009, 01:02 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