Solved How to SUM value in subform via VBA code?

yunhsuan

Member
Local time
Today, 08:04
Joined
Sep 10, 2021
Messages
54
Hello~
I use SUM() to calculate value in subform on main Access Form by control data source (Below is "Test" file).
But the value would become unchangeable. So I want to calculate value by using VBA code.
I have tried to use DSum fn, but I failed. Maybe I used the wrong code.
Can any one tell me how to write the code?

Also, can SUM fn skip Null and properly calculate value?
 

Attachments

Aggregate functions ignore Null and only include records where field has data.

I hope you use better naming convention in real database. For starters, don't use spaces.

These work:
=[Table2]![Tax excluded]
=[Table2]![Taxes]
=[Table2]![Tax included]
 
Use query.
 

Attachments

Thanks for suggestions! The problem was resolved successfully.
 

Users who are viewing this thread

Back
Top Bottom