Help with use of DSum or Sum in a textbox control

  • Thread starter rashar via AccessMonster.com
  • Start date
R

rashar via AccessMonster.com

Hello,

I have a textbox on my form labled Quantity_This. My query, qry1 returns
multiple items, and accessories. I have another textbox on the form called
Accessory_Type which pulls the accessory type from my qry1.

When my form opens, I can see the accessory type based on the item I select.
What I want to do is when a user enters a value in the Quantity_This textbox
for multiple items under a specific Accessory Type, I want my textbox,
CalcAccGroup that contains the below DSum script, to automatically sum the
values.

=DSum(nz([Quantity_This],0),"qry1 ","[Accessory_Type] = 20")

The problem I have with the above script, is if I enter in a quantity of 30
for item1 accessory type 20, and a quantity of 30 for item2 accessory type 20,
the result in my CalcAccGroup textbox shows a value of 420. So my DSum logic
multiplies 60 by 7 when it should be 40. The 7 comes from the first
Accessory_Type in my qry1.

What am I doing wrong with the above script? Should I be using a Select =Sum
for the control source? And if so, what would the syntax be for that?

Thanks,

Rashar
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top