>i want to sum if data in table in access database. means same item must be
>calculate sum.
>sum if like sum if in excel. how to write code?
Try this kind of expression:
Sum(IIf(condition, item, 0))
--
Marsh
MVP [MS Access]
"Marshall Barton" wrote:
Dear member,
I want to create coding for sum if in access.
Any can translate to me how to code sum if.
Table1 have tickectNo, item_partno and qty
Table2 have item_partno, qty1, qty2, and result.
When I click one button generate;
* sum (qty in table1) insert to qty2 in table2
* qty2 - qty 1 insert to result
pls help me to code in VBA
VBA would be a slow and complicated way to do that kind of
calculation. Instead, you should use a query to sum a
column of values in a database table. Even then the result
should not be saved back to any table.
I guess what I am trying to say is that the way you would
create a spreadsheet does not work when you are creating a
database. You need to do some homework or take a class in
database design and using queries before you start trying to
do the kinds of things you are asking about.