Hi, Babs.
First, I am going to assume that this is an application you intend to do
completely in Access once you have your basic percentage formulas entered,
i.e., there will be no ongoing requirement to import data from Excel.
If this is the case, I think you will require several tables for this job.
All of them are simple in themselves; splitting them into multiple tables
will make using it so much easier than in Excel alone because you will be
harnessing the power of a relational database.
You didn’t mention it in this post, but I’m inferring from your initial post
that you intend also to keep a record of each batch that would include the
quantity of final product produced, the final product batch number, perhaps
the date and/or operator, and the batch number of each raw material used. Is
this correct?
If this is so, you have the following relationships to account for in your
application:
Batch (one) to Batch Ingredients (many)
Product (many) to Ingredients (many)
The latter means a product may have many ingredients, and an ingredient may
be used in many products. The best way to represent this relationship is
with two one-to-many relationships. Based on what you’ve told me, I suggest
the following tables to capture the basic formulas:
Products
----------
ProductID AutoNumber or Integer (Primary Key)
Product Text
Density Single or Double Floating Point
DefaultBatchSize Number
Unit Text or Numeric Foreign Key to a Units table
…any other product-specific information
Ingredients
-------------
IngredientID AutoNumber or Integer (PK)
Ingredient Text
Density Single or Double Floating Point
…any other raw material-specific information
ProductIngredients
---------------------
ProductIngredientID AutoNumber (PK)
ProductID Integer (Foreign Key to Products)
IngredientID Integer (Foreign Key to Ingredients)
Fraction Single or Double Floating Point
The first two tables store the basic information about all of your Products
and raw materials, respectively. The last stores your basic formula to
produce 1 unit of product, and represents the 1-to-many relationships to each
of them.
To enter the formulae, I would create a main form based on the Products
table, and a subform based on ProductIngredients, representing foreign keys
with combo boxes to facilitate the data entry. A control in the subform’s
footer would be handy to ensure that the total of the fraction field = 1.0
(=Sum([Fraction]).
Once the basic products, raw materials, and product ingredients have been
entered, it will be easy to calculate the required amounts for any size
batch: [Fraction]*[BatchSize]
To capture the information, I suggest two additional tables:
Batch
--------
BatchID AutoNumber or Integer or Text (PK)
ProductID Integer
BatchDate Date/Time
…any other Batch-specific information
BatchIngredients
-------------------
BatchIngID AutoNumber (PK)
BatchID Foreign Key to Batch (Match Type with BatchID)
RawMaterialID Integer (Foreign Key to RawMaterials)
BatchNumber Integer or Text
The way I see this working is you enter a new batch number, select the
Product ID from a combo box, and enter the Qty to be produced. At some
event, either by pressing a button or from the combo box’ AfterUpdate event,
you will need to execute an insert query to insert records into
BatchIngredients with the BatchID entered and the RawMaterialID from the
ProductIngredients table for each ingredient in this product. Probably the
easiest way to do this is to create the multi-table query in Design mode and
then call it using the OpenQuery method.
On a form based on Batch with a subform based on BatchIngredients, the
operator can enter the BatchNumber(s) for each ingredient.
A lot of work to be sure, to set it up. But simple when you’re done.
HTH
Sprinks
babs said:
thanks for the advice on the transpose copy paste but still more questions.
Not quite sure how to set up the table.
example of record??
finished prod. # finished prod name raw material code raw mat name lot #
ABC 1" masking tape 232 rubber 45
2828 toluene 11
376 mineral spt. 49
As you see the finished prod # and name need to be listed once and then the
ingredients that go into it will tak up numerous records if I list them down
instead of across. I would like to generate a form automatically with the
ingredients so production can enter the lot # they used without haveing to
put the raw matl. code and name in. Is this a place where I need a sub
form(subtable- is there such a thing?. Not sure how to set up the underlying
table even though as in example above.
Thanks,
Barb
:
Babs,
Before importing the data into Access, do a Copy/Paste Special (Transpose)
to rearrange the data so that the columns become rows (and vice versa).
HTH
Sprinks
:
I am putting together table/queries/forms to produce a product and need to
follow lot #s of raw materials put into them and back calcuate quantities of
raw materials used based on the final quantity of product produced.
I have started with one table of the list of raw material recieved. Example
- raw materials #,name - 123(rubber),367(toluen),8989(mineral spirits) we'll
say that these three products make tape ABC,1" masking tape which is the
final product id and name. Every final product has a list of raw materials
and percent of what goes in to make a given final quantity. I have an excel
spreadsheet that lists each final product#, name and across as column
headings is ALL the raw materials listed.
example.
final prod.name prod# rubber milk toluene mineral spts
1" masking tape abc .50 0 .34 .22
I feel like the raw material should be listed down instead of across. In the
raw material table the items are listed down. I would like to generate a
form for production when they are making the 1" tape(final prod) that would
list the raw material that go into it and would give them a field to put in
the lot # and the qty that they used next to each raw material. I can see
grabbing this from a table created from the excel spreadsheet example but
find it odd that the ex. rubber is now a field name in that table.
Please help - on this table layout!!!
Thanks,Barb