Assign dynamic query value to text box ???

Chunk

Registered User.
Local time
Today, 16:53
Joined
Oct 25, 2004
Messages
64
I have the following query, which I know works.

The query is called "products_due_in_query"
Code:
SELECT Sum([Supplier_order_line].[quantity]) AS [Due_in]
FROM Supplier_order_line
WHERE (((Supplier_order_line.order_line_status)="Awaiting delivery") AND ((Supplier_order_line.product_number)=[product_number_combo]));

product_number_combo is a combobox on a form called "product_enquiry".

I have a text box on "product_enquiry", which I want to show the value of "Due In" (from the query), when the user selects a product_number from the product_number_combo combobox.

How can I do this? I have tried setting the text box control source to products_due_in_query.Due_in but all I get is "#name".

I thought about doing it with VB code, but dont know how.

I have used .recordSource before, to assign a value to a combobox, but I dont know how to do it for a text box.

Can anyone help?

Thanks very much.
 
Try using the DSum function. You can use it as an expression right in the control source of your text box. It would be something like:

Code:
=Dsum("Quantity", "Supplier_order_line", "Order_line_status = 'Awaiting delivery' AND product_number = " & Me.product_number_combo)
 

Users who are viewing this thread

Back
Top Bottom