Results 1 to 3 of 3
  1. #1
    dnjtdjq is offline Novice
    Windows 7 32bit Access 2013 64bit
    Join Date
    Mar 2017
    Posts
    4

    D lookup Formula on Subform

    Hello,

    I am trying to make a recipe template with Access and I really need help on using d-lookup or search button so the price can automatically pop up.



    So I have watched a tutorial on youtube on how to make a recipe template on access and basically did the same thing as the instruction but want to add a little twist to it. There are 3 tables that I created, which are ingredients table, recipe table and combined table.

    Ingredients table consists of Ingredient ID, Ingredient and price.

    Recipe Table consist of recipe ID, recipe and instructions.

    Lastly, combined table consist of Recipe ID, Ingredients, Price, Amount and Total.

    Like attached image, I used Recipe Table as my main form and added combined Table as my sub-form.

    But when I added combined table as my subform I have deleted "recipe ID", so there are only 4 fields that are Ingredients, Price, Amount and total.

    So basically what I want to do is if I choose the ingredient from the subform, the price automatically comes along with it.

    In the price field, I have used dlookup that looks like "=DLookUp("Price","IngredientsT","Ingredient=" & [IngredientsID])" and tried many variations of this but never worked.

    I would really appreciate it if anyone who is familiar with dlookup or knows what I am doing wrong could give me an advice.

    Click image for larger version. 

Name:	Capture.PNG 
Views:	7 
Size:	39.6 KB 
ID:	28382

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    More efficient and easier:

    http://www.baldyweb.com/Autofill.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Though if I had to guess, ingredient should be ingredientID. But I'd go with the other method.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Using Dlookup in Subform
    By dnjtdjq in forum Forms
    Replies: 6
    Last Post: 03-23-2017, 05:20 PM
  2. Trouble with DLookup on Subform
    By GregShah in forum Forms
    Replies: 13
    Last Post: 12-14-2016, 12:41 AM
  3. Trouble with DLOOKUP in a Subform
    By Mubashir sabir in forum Forms
    Replies: 2
    Last Post: 08-21-2015, 01:38 PM
  4. Dlookup not working in Subform
    By keiath in forum Forms
    Replies: 1
    Last Post: 04-23-2014, 09:03 AM
  5. Subform Dlookup
    By jbedward in forum Forms
    Replies: 7
    Last Post: 01-13-2010, 08:06 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums