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!

sum of a field in access

Status
Not open for further replies.

buddyel

MIS
Mar 3, 2002
279
US
I have a form based on a query that prompts for a particular part number. what I would like the value of a textbox (txtYTDCO1) to equal the sum of all values in the QTY field for that particular part number. Can anyone help?
 
"select sum(qty) as qty from table where id=part number"

 
dim rs as new adodb.recordset
str2="select sum(qty) as qty from table where id=" & partnumber

rs.open str2,cnn,adopendynamic,adlockoptimistic
if rs.bof = false then
if isnull(rs!qty)=false then
txtYTDCO1.text=rs!qty
end if
end if
rs.close
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top