By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,650 Members | 753 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,650 IT Pros & Developers. It's quick & easy.

How to display the total of an order in a form

P: 11
In an order system, there are tables of customers, products, orders, and order details, with the main fields listed as follows:

tblCostomer: CustomerID, CustomerName, ...
tblProduct: ProductID, ProductName, ...
tblOrder: OrderID, CustomerID, OrderDate, ...
tblOrderDetail: OrderID, ProductID, UnitPrice, Amount, Total, ...

I have created a query "qryTotalByOrder" which will sum up the total for each order by grouping corresponding products in that order:

qryTotalByOrder: CustomerID, OrderID, OrderDate, Total

I would like to add an unbound text box in a form " which will display the Total of a particular order by entering the orderID as a parameter. What do I need to put in the Source of Data of the textbox? Thanks.
Sep 4 '08 #1
Share this Question
Share on Google+
1 Reply


Expert Mod 2.5K+
P: 2,545
Hi. The domain lookup function DLookup will do this for you. Assuming the OrderID field is numeric, enter

Expand|Select|Wrap|Line Numbers
  1. =DLookup("[Totals]", "[QryTotalByOrder]", "[OrderID] = " & [YourOrderIDTextboxName])
If the order ID is a string, you will need single quotes on either side of its value:
Expand|Select|Wrap|Line Numbers
  1. =DLookup("[Totals]", "[QryTotalByOrder]", "[OrderID] = '" & [YourOrderIDTextboxName] & "'")
-Stewart
Sep 4 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.