ms access - How to store data where the columns need to be different everytime? -
i writing crud application store client information. however, each client requires different data stored. e.g. 1 client may require data relating vehicle stored whilst requires information regarding fishing rods stored. have many new clients each week , have 100 current ones. there anyway around creating new table each client?
edit: using access 2010
don't store information on different products in different columns! must normalize database. in case need have @ least 3 tables
table customer -------------- customerid (pk) name address etc. table product ------------- productid (pk) name price etc. table customeritem ------------------ customeritemid (pk) customerid (fk) productid (fk) date remarks etc.
if storing orders (or invoices) must replace customeritem
table following 2 tables:
table order ----------- orderid (pk) customerid (fk) date etc. table orderitem --------------- orderid (pk, fk) productid (pk, fk) quantity price etc.
(pk) denotes primary key columns, (fk) foreign key columns.
the database diagram looks this:
customer 1 | n +------> order product 1 | n n | 1 +------> orderitem <------+
this enables store arbitrary number of informations per customer using same columns. instead of using different columns, add new related records (e.g. new order or new order item in existing order).
Comments
Post a Comment