Re: Show SUM query results in textbox on form


J

John Vinson

I have a form build around a table which displays the jewelry we have in inventory and the value of each piece.

I have created a query (qryJewelryValue) that is a sum of the value field in the jewelry table.

What I would like to do is show that value on a label or in a textbox but I have not been able to do this. Ideally I would rather not use a subform. Is there a way to do this? And if there is, is there a way to do it without the query table opening up and overlapping the form when the form is run (I tried running the query on load and had this happen).

Any help would be appreciated.
Use the Form (or Subform's) Footer. Put a textbox in it with a control
source

=Sum([value])

The totals query isn't really needed, though if you want it for some
other reason, you can set the control source of a textbox to

=DLookUp("[SumOfValue]", "qryJewelryValue")

In no case is it necessary to open the query datasheet at all - you
don't need to "run" the query in order for it to have a value!
 
Ad

Advertisements

G

Guest

Thank you John this worked like a charm - much appreciated.

John Vinson said:
I have a form build around a table which displays the jewelry we have in inventory and the value of each piece.

I have created a query (qryJewelryValue) that is a sum of the value field in the jewelry table.

What I would like to do is show that value on a label or in a textbox but I have not been able to do this. Ideally I would rather not use a subform. Is there a way to do this? And if there is, is there a way to do it without the query table opening up and overlapping the form when the form is run (I tried running the query on load and had this happen).

Any help would be appreciated.
Use the Form (or Subform's) Footer. Put a textbox in it with a control
source

=Sum([value])

The totals query isn't really needed, though if you want it for some
other reason, you can set the control source of a textbox to

=DLookUp("[SumOfValue]", "qryJewelryValue")

In no case is it necessary to open the query datasheet at all - you
don't need to "run" the query in order for it to have a value!
 

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