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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Assign a select query value to a form textbox

Status
Not open for further replies.

MiltonSnider

Programmer
Feb 6, 2002
3
0
0
US
Hello I would like to assign the value of a query, this is a select query with a single value, to the control of a textbox. I tried typing [query].[linetotal] as the control but I get #Name?
the query is as follows and works as long as the form is open, since criteria comes from the form.

SELECT (Sum([Quantity]*[UnitPrice]) AS LineTotal
FROM BOC INNER JOIN ((OrgCodes INNER JOIN Orders ON OrgCodes.OrgcodeID = Orders.OrgCodeID) INNER JOIN OrderDetail ON Orders.OrderID = OrderDetail.OrderID) ON BOC.BOC = Orders.BOC)
WHERE (((OrgCodes.OrgcodeID)=[Forms]![AO15]![Borg]) AND ((BOC.BOC)=[Forms]![AO15]![Combo135]))

thanks
Milton
miltonsnider@yahoo.com
 
In the textbox 'Control Source' property, type:
=[Query]![Field]

It should work. Good luck.
 
I'm using '!' instead of '.'
I've tried and it did work.
Did you at your query if there's a result in the LineTotal field?
 
Yes the query does have a single value as the result. But the query does require a form to be open, since some criteria is from other selections on the same form the results should be displayed.
Milton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top