Results 1 to 3 of 3
  1. #1
    mt1013 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2013
    Posts
    16

    Having trouble running a subtotal text box in a subform using a Dsum function

    Hello.

    I can't get my dsum function to work in my subform: I'm running a subtotal against a percentage field. I did a test in a reqular query and got the results I wanted but in the real world all I get is a zero where there should be a roll up of the previous rows. I tried putting the function in the control source of the text box and I tried writing a sql statement as part of a recordset but again no results. As a matter of fact, at least i'm getting zeros when I put the function in a text box. If I try to do a procedure with it I just get errors. The SQL statement is different when I take it from the select query to VBA. I'm no sure if its a syntax problem...or.

    Can anybody point out how I could adapt these statements or function below to workable VBA Code?

    Thanks

    Here is the working function when I test it in a select statement:




    RunningPayoutBalance: Format(DSum("MaxTierPayout","tbl_curvesourceinput" ,"[Test] <= " & [DupTest] & ""),"Fixed")

    Here is the working SQL statement from the select query:

    SELECT tbl_CurveSourceInput.Test AS DupTest, Format(DSum("MaxTierPayout","tbl_curvesourceinput" ,"[Test] <= " & [DupTest] & ""),"Fixed") AS RunningPayoutBalance
    FROM tbl_CurveSourceInput
    GROUP BY tbl_CurveSourceInput.Test;

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If the DSum works in query, why not just bind textbox to the field?

    I would not use Format() function in query. It results in a text value, not a number.
    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
    mt1013 is offline Novice
    Windows XP Access 2007
    Join Date
    Oct 2013
    Posts
    16
    Quote Originally Posted by June7 View Post
    If the DSum works in query, why not just bind textbox to the field?

    I would not use Format() function in query. It results in a text value, not a number.


    Thanks.

    I didn't think of that. I'll give it a try and get back to you. It's getting late and I need to get some sleep. Thanks you.

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

Similar Threads

  1. DSUM Running total by group
    By chowing0823 in forum Access
    Replies: 10
    Last Post: 10-07-2022, 03:15 AM
  2. Value of Subtotal from Subform Changes
    By GregShah in forum Forms
    Replies: 4
    Last Post: 08-12-2015, 11:40 AM
  3. Replies: 4
    Last Post: 09-27-2012, 02:23 PM
  4. Replies: 0
    Last Post: 07-15-2010, 12:32 PM
  5. Replies: 25
    Last Post: 03-31-2010, 11:10 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