Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text box value based on query 1

Status
Not open for further replies.

theUN4GVEN

Programmer
Apr 12, 2004
10
US
I have a textbox on a form that I would like to contain the total sum of the price of parts for an individual client. The textbox should only contain the values for the prices of the parts for the current individual only. I have no problems obtaining this information through the following query:

SELECT sum(Quantity * Price)
FROM tblParts
WHERE InvoiceID = 23;

for one specific example where the InvoiceID = 23. I can run a query similar to this to fill a listbox based upon the current InvoiceID that the form is on, but cannot figure out how to do the same for a textbox. I have tried setting the textbox to a listbox but cannot get this to work when the current record changes. Any help would be appreciated explaining how to fill my textbox based upon this query where the invoice ID changes as the record changes.

Thank you!
 
Set the control source of the text box like this:

=DSum("Quantity * Price","tblParts","InvoiceID = " & [InvoiceID])
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top