My Assistant
![]() ![]() |
|
|
Mar 15 2012, 03:37 PM
Post
#1
|
|
|
New Member Posts: 6 |
I have a query that tracks customers order 2 of the columns include Fruit and types, based on that choice I need to lookup cost on a table(marketPrice)
ID Fruits Type Cost 1 Banana Fresh 2.99 2 Banana Dried 3.99 3 Apple Fresh 2.95 4 Apple Dried 4.35 5 Mango Fresh 3.99 6 Mango Dried 4.99 So I will need My look cost from query below... OrderID FirstName LastName Fruits Type Quantity Cost TotalPrice 2001 John Smith Banana Fresh 4 DlookUp() Cost*Quantity 2012 Michael Beuer Strawberry Dried 5 DlookUp() Cost*Quantity Thanks! |
|
|
|
Mar 15 2012, 03:45 PM
Post
#2
|
|
|
UtterAccess VIP Posts: 17,607 From: Don Mills, ON (Canada) |
(IMG:style_emoticons/default/welcome2UA.gif)
You really don't want to use DLookup in queries: it's very inefficient. Join your Orders table to your Price table, and bring in the prices that way. |
|
|
|
Mar 15 2012, 03:47 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 7,394 From: Oadby Leics, UK |
Dlookup("Cost", "marketprice", "Fruits= '" & Fruits & "' and Type ='" & type & "'")
|
|
|
|
Mar 15 2012, 05:13 PM
Post
#4
|
|
|
New Member Posts: 6 |
Thanks
|
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 18th May 2013 - 02:52 PM |