Get data for a text box from a query

harrisw

Registered User.
Local time
Today, 15:54
Joined
Mar 27, 2001
Messages
131
How can I use the data from a query and put the result in a text box.

I've tried the following but it doesn't work

Me![Order Total] = [qryCalculateInvoiceCost]![SumOfPrice]
 
If the form is based on the query then it's just =Sum([your field]) if it isn't then it's DLookUp.
HTH
 
No

I have a query that I want the text box to get its data from.
 
You can only have one recordsource for a form/report and all the controls are either bound to that recordset or are calculated. There are various ways to obtain data from multiple tables/queries. The easiest of course is to include all the source tables/queries in a single query that joins them and use that for the recordsource for the form/report. In your case, you seem to want an aggregate function so you could not include that query in the form's recordsource because it would make the form non-updateable.

Another option is DLookup(), which can get a value from a query or a table. Queries and tables are interchangeable for most uses.

You might also be able to put a calculated control in the footer of the subform to sum the items on the invoice.
 

Users who are viewing this thread

Back
Top Bottom