Share via

using the sum function

Anonymous
2018-06-10T22:53:12+00:00

I have a form with a text box in it and the control source in the properties is : =Sum([Profit/Loss]).

I need to add another column to it and from what I have been able to find it should look like this :  =Sum([Profit/Loss]+[txtcomm]) but this gives me an error message In the text box. What am I doing wrong?

both columns are currency and I am trying to add the total of both columns.

thank you

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

13 answers

Sort by: Most helpful
  1. Anonymous
    2018-06-13T23:07:47+00:00

    Null propagates in arithmetical expressions, so where anything in the expression might be Null the Nz function should be called to return a zero in place of a Null, e.g.  Nz(Sum([comm]),0)

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-06-13T20:53:21+00:00

    thanks for the reply. the DLookup worked which has brought up another problem. this expression and another I have in a query should give me the same result but they don't. there off by about 26.00. I decided to make a blank table add a couple entries and see if I see a math problem. with  =Sum([ProfitLoss])+Sum([comm])+DLookUp("InitialEquity","tblEquity") I got no result.  I found the the comm column was the problem. It doesn't have any entries. I tried =Sum([ProfitLoss])+SumNZ([comm])+DLookUp("InitialEquity","tblEquity") but gfot an error message #name!. How do I get it to ignore blank entries?

    thanks again

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2018-06-12T18:05:35+00:00

    You can only reference a column in a table directly if the table is a component of the form's recordset.  Otherwise you need to call the DLookup function:

    DLookup("InitialEquity","tblEquity")

    Was this answer helpful?

    0 comments No comments