Update a table with results from a query (1 Viewer)

DampFloor

Registered User.
Local time
Today, 00:56
Joined
Nov 16, 2017
Messages
37
Hello,

I am creating a database which identifies the cheapest supplier for each ingredient. I then need the identified cheapest price for each ingredient to populate a table which shows which ingredients are in which item. I created a query which can identify which vendor sells each ingredient the cheapest but cannot figure out how to get this data into the menu table. Attached are images of my min price query and menu list table
 

Attachments

  • Menu_List.png
    Menu_List.png
    27 KB · Views: 124
  • Min_Price.png
    Min_Price.png
    46.6 KB · Views: 115

MarkK

bit cruncher
Local time
Today, 00:56
Joined
Mar 17, 2004
Messages
8,179
It never makes sense in a database to have a item1, item2, item3, ..., itemN in the same row.
Mark
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 02:56
Joined
Feb 28, 2001
Messages
27,140
Not to be "piling on" but you need to take a quick review of normalization (regarding having fields like Ingredient1, Ingredient2, etc.) and either subqueries or JOIN queries as to how to bring the "cheapest source" query together with your main query.

Further, since I'll bet prices fluctuate, you don't want that information stored in the table. You want a query that shows you the cheapest sources today. And there is nothing wrong with the idea of basing a report or form on a query. And old recordset in a storm, as the old paraphrasing goes...
 

DampFloor

Registered User.
Local time
Today, 00:56
Joined
Nov 16, 2017
Messages
37
OK thanks for the help everyone. My apologies, this is my first time making a database.

i attached an image of the table and query i made which contains the menu ID and which ingredients are contained within that menu item. However i still cannot figure out how to get the lowest prices which i have found to be shown beside the the ingredients in a menu. Any help would be appreciated.
 

Attachments

  • Menu_Ingredients_Query.png
    Menu_Ingredients_Query.png
    60 KB · Views: 100
  • Menu_Ingredients_Table.png
    Menu_Ingredients_Table.png
    51.6 KB · Views: 93

JHB

Have been here a while
Local time
Today, 09:56
Joined
Jun 17, 2012
Messages
7,732
Where should the price come from?
Show some data from that table?
To get the lowest price use the function Min().
If you can't get it post your database, (zip it).
 

DampFloor

Registered User.
Local time
Today, 00:56
Joined
Nov 16, 2017
Messages
37
Hi JHB,

The price comes from a list of quotes given from suppliers.I did use the min function to return the lowest cost supplier for each ingredient. I have attached the database to this reply.
 

Attachments

  • 4I DB.zip
    31.5 KB · Views: 72

JHB

Have been here a while
Local time
Today, 09:56
Joined
Jun 17, 2012
Messages
7,732
Open the query JHBFinalQuery.
You've an error in table Menu_Ingredient, the field Ingredient ID need to be Number type and not Text.
 

Attachments

  • 4I DB.accdb
    560 KB · Views: 97

DampFloor

Registered User.
Local time
Today, 00:56
Joined
Nov 16, 2017
Messages
37
Thank you so much! This is a school project and there is a long way to go on it, so don't be suprised if you see more posts from me. Thank you again for the help, hopefully i can become more self sufficient with this
 

JHB

Have been here a while
Local time
Today, 09:56
Joined
Jun 17, 2012
Messages
7,732
You're welcome - good luck.
 

Mark_

Longboard on the internet
Local time
Today, 00:56
Joined
Sep 12, 2017
Messages
2,111
Please note, if this is a school assignment please specify when posting. The advice you get will be a bit different as we will know we need to explain more, though are less apt to give you exactly what needs to be done.

You will probably be given more references to "Here is how you do this in general with a detailed reason WHY" rather than "Min([YourField])" type answers.
 

Mark_

Longboard on the internet
Local time
Today, 00:56
Joined
Sep 12, 2017
Messages
2,111
Please note, if this is a school assignment please specify when posting. The advice you get will be a bit different as we will know we need to explain more, though are less apt to give you exactly what needs to be done.

You will probably be given more references to "Here is how you do this in general with a detailed reason WHY" rather than "Min([YourField])" type answers.
 

Users who are viewing this thread

Top Bottom