first of all, it appears that you're using Lookup fields in your tables.
recommend you get rid of them, see
http://home.att.net/~california.db/tips.html#aTip8 for more information.
let's look at the declared relationships:
Categories.CategoryID 1:n ProductsTTL.CategoryID
so one category may have many products, but each product belongs to only one
category. okay, makes sense.
OrderDetails.OrderID 1:n Orders.OrderID
so one order detail record may belong to many orders, but each order has
only one detail record. this relationship seems to be backward. usually an
Order record contains data that applies to an entire single order - such as
Customer, DateOrdered, etc. an OrderDetail record usually contains data
about each specific product included in one order, so "one order may have
many details records, but each detail record belongs to only one order".
Orders.PurchaserID 1:n tblPurchaser.PurchaserID
ditto this relationship - backwards. normally one purchaser may have many
orders, while each order belongs to only one purchaser.
and ditto again on Orders.ProjectID 1:n Projects.ProjID - probably should be
Projects.ProjID 1:n Orders.ProjectID
other than that, you have some normalization issues, such as:
1) table ProductsTTL probably should not have a SupplierCode field in it.
i'm guessing that SupplierCode describes a supplier; since the SupplierID
field already links a product record back to a specific supplier record, you
don't need another "suppliers field" in the products table.
2) since each product is linked to a supplier, you probably should not link
each order to a supplier, so the SupplierName and SupplierCode fields do not
belong in the Orders table.
3) i don't know what a UOM is, but since each product is linked to a
specific record in the UOM table, again you probably should not have a UOM
field in the Orders table.
4) you have an OrdersDetail table to list each product that is part of each
order, so you should not have a ProductID field in the Orders table.
5) and again, each product is linked to a category in table ProductsTTL, so
you probably should not have a category field in the Orders table.
i really urge you to read up on relational design principles before you go
any further. poorly structured tables will cause problem after problem for
you, as you begin to build queries, forms, and reports. recommend you go to
the link i provided elsewhere in this thread, and use those resources to
learn proper data normalization.
hth
lmv said:
Ok...
(Table)ProductsTTL
ProductID(primary key,#)
ProductName (Text)
SupplierID (Text) Lookup to qrySupplierLookup)
SupplierCode (Text)
CategoryID (Foreign)#
UnitMultiple (Text) (SELECT tblUOM.UnitMultiple FROM tblUOM ORDER BY
tblUOM.UnitMultiple
UnitPrice (currency)
Quantity (#)
QTYNeed (#)
Order (ck box)Linked to QTYNeed
LastEdited
(Table
Orders
OrderID(primary key,#)
ProjectID (Text)(SELECT Projects.ProjID, Projects.ProjectName FROM Projects
CategoryID (# Lookup to Categories table)
PurchaserID (Text)
RequestedBy (Text)(SELECT Overseer.[Last Name], Overseer.OverseersID FROM
Overseer ORDER BY Overseer.[Last Name]
SupplierName (Text)(qrySupplierLookup)
SupplierCode (Text)(SELECT ProductsTTL.ProductName, ProductsTTL.SupplierCode
FROM ProductsTTL
OrderDate (Date/time)
RequiredDate (Date/time)
Description (text)
ProductID (Text) SELECT (DISTINCTROW ProductsTTL.ProductID,
ProductsTTL.ProductName,
UOM (SELECT tblUOM.UnitMultiple FROM tblUOM ORDER BY tblUOM.UnitMultiple
Price (currency)
LastEdited (Date/time)
Table:Order Details
OrderID(primary key,#)
ProductID(primary key,#) (composite)
Quantity (#)
UnitPrice (Currency)
Categories.CategoryID 1:n ProductsTTL.CategoryID
ProductsTTL.ProductID 1:n Order Details.ProductID
Order Details.OrderID 1:n Order.OrderID
Orders.PurchaserID 1:n tblPurchaser.PurchaserID
Orders.ProjectID 1;n Projects.ProjID
My biggest problem is if I need to get the info from the ProductsTTL table
to append to my orders table... when a QTY needed is entered and checked
off...
thanks!
lmv
tina,
Thanks for the response...
it's not clear what you mean here. if you're *literally* storing product
data in the orders table, that is duplicating data.
You're right all I need to "store" is the qtyneeded & a Nunitprice (new)
All other info should be lookup...
So you are saying my Order Details Tbl just needs ProductID though my form
should be linked with a query to the productTTL the Order and Order Detail...
I don't want a combo because I want to see ALL that categories products
from the products tbl which will be sorted by category automatically
when
the
person selects what category (cbo to the categories tbl) They will see
it
in
the subfrm in my orderfrm.
So, I have a form based on a qry with alot of glitches at this point
following
SELECT ProductsTTL.*, Orders.OrderID, Orders.ProjectID, Orders.CategoryID,
Orders.Department, [Order Details].NUnitPrice, [Order Details].Quantity,
Orders.PurchaserID, Orders.OrderDate, Orders.RequiredDate, Orders.Description
FROM ProductsTTL LEFT JOIN (Orders RIGHT JOIN [Order Details] ON
Orders.OrderID = [Order Details].OrderID) ON ProductsTTL.ProductID = [Order
Details].ProductID;
(All this inner join right and left I don't understand)
BUT... the question still is if the person adds qtyneeded to the box
on
the
qryfrm how does all of the data get saved in the orders and orders detail
tbls? And can I have the check box so that they can see that they
ordered
an
item on the list without it being bound to the ProductsTTL table?
option). or you could open a recordset in VBA to retrieve the fields
,
and
assign the values to one or more unbound textbox controls.
I don't know how to do this...
I am sorry that I can't make this more clear... I am so new and conceptually
I know what I want to do but I don't have the skill yet to accomplish
it.
I
know the order detail should be able to be viewed by the form I design even
if it is just numbers etc in the table and that I should be able to
manipulate it for reports/invoices etc. But, I am researching/reading looking
at others examples until my eyes blur and then I still don't know what step
to start with. And now half of my forms don't work because the qry is
wrong...