SUMIF Function with Textbox Value

adrian94

New member
Local time
Today, 10:58
Joined
Jul 10, 2014
Messages
4
Hello, I am currently working on a form. I used textbox to set the value of currency and sumif to total nett price for all of data with that specified currency.

How can I get the value of the textbox?

I use formula :
=Sum(IIf([Currency]="USD",[NettPrice],0))
and it's worked. It sums up all net price with USD currency

However, the currency types are so many and it's impossible for me to list them down one by one, so I use this formula :
=Sum(IIf([Currency]=[txtCurrenct],[NetPrice],0))

But it keep showing 0 result.

Can anybody help me? I would highly appreciate if you can give solutions for my problem.

Thank you very much.
 
Maybe because of a typo, I suppose it should be txtCurrency
=Sum(IIf([Currency]=[txtCurrenct],[NetPrice],0))
 
sorry, I typo when copy that in this thread. but, in my program, I already use txtCurrency
 
Have you tried something like:
= DSum("NettPrice", "[YourTableName]", "Currency = '" & Me.txtCurrency & "'")
 
Thanks Bob for the answer,but i don't know it shows error result: #Name?

Even if I use
=DSum("NettPrice", "[YourTableName]", "Currency = '"USD"'")
It still shows #Name?

hmmm... I confused....
 
You could also
1. Create a Totals query to sum up the net price Grouped By currency.
2. Use this query to do a right join to your form's query
4. Include the summed field in your form.
 
You could also
1. Create a Totals query to sum up the net price Grouped By currency.
2. Use this query to do a right join to your form's query
4. Include the summed field in your form.


Can you show me how to create that query? Thanks
 
Thanks Bob for the answer,but i don't know it shows error result: #Name?

Even if I use
=DSum("NettPrice", "[YourTableName]", "Currency = '"USD"'")
It still shows #Name?

hmmm... I confused....
Did you replace the text in red with the actual name of your table/query.
 

Users who are viewing this thread

Back
Top Bottom