UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Need Help With Dlookup    
 
   
wwchico
post 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!

Go to the top of the page
 
+
Doug Steele
post 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.
Go to the top of the page
 
+
Peter46
post 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 & "'")
Go to the top of the page
 
+
wwchico
post Mar 15 2012, 05:13 PM
Post #4

New Member
Posts: 6



Thanks
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th May 2013 - 02:52 PM