A
Arthur
I have a traditional table structure linking stores,
products, and orders as follows:
Stores.StoreID
Stores.Address (etc.)
Products.ProductID
Products.Description
Products.ProductType
Products.Promo (a positive integer)
Orders.StoreID
Orders.ProductID
Orders.Quantity
Joins:
Stores.StoreID to Orders.StoreID (1 to M)
Products.ProductID to Orders.ProductID (1 to M)
For any particular Products.ProductType, Products.Promo is
a sequence number indicating ranking (importance), with
1 being highest, then 2, then 3, and so on.
A fourth table is called Survey. It contains information
about the stores - the "ideal" number of units to be
ordered. The fields are:
Survey.StoreID
Survey.ProductType
Survey.Priority
Survey.IdealUnits
Here's how it's supposed to work. Take a particular
ProductType for any particular store, and suppose the
Survey table has this data:
ProductType Priority IdealUnits
WB 1 3
WB 2 2
.... and the Products table has this data:
ProductID ProductType Promo
75 WB 1
84 WB 2
Then the order would be:
ProductID Quantity
75 3
84 2
The "ideal" mix of two products (as shown in the Survey
table) is possible because there are also two
Promo's, as shown in the Products table.
But if the Products table is:
ProductID ProductType Promo
84 WB 1
Then the order would be:
ProductID Quantity
84 5
There is only one Promo for this ProductType. Since the
store has space for 5 (Survey shows 3+2), five of this one
product is ordered.
Finally, if the Products table is:
ProductID ProductType Promo
75 WB 1
84 WB 2
27 WB 3
.... then the order is:
ProductID Quantity
75 3
84 2
There is not space for a third promo for this ProductType
in this store.
Get the general idea?
Right now I have the three tables loaded with data:
Products, Stores, Survey. I think that there must be a way
with queries to create my Orders table. (I don't know VBA
yet).
Is this not possible with queries?
Can someone give me a steer please? For instance I don't
even know whether to try to link the Survey table with the
others or not, and if so how....?
Art
products, and orders as follows:
Stores.StoreID
Stores.Address (etc.)
Products.ProductID
Products.Description
Products.ProductType
Products.Promo (a positive integer)
Orders.StoreID
Orders.ProductID
Orders.Quantity
Joins:
Stores.StoreID to Orders.StoreID (1 to M)
Products.ProductID to Orders.ProductID (1 to M)
For any particular Products.ProductType, Products.Promo is
a sequence number indicating ranking (importance), with
1 being highest, then 2, then 3, and so on.
A fourth table is called Survey. It contains information
about the stores - the "ideal" number of units to be
ordered. The fields are:
Survey.StoreID
Survey.ProductType
Survey.Priority
Survey.IdealUnits
Here's how it's supposed to work. Take a particular
ProductType for any particular store, and suppose the
Survey table has this data:
ProductType Priority IdealUnits
WB 1 3
WB 2 2
.... and the Products table has this data:
ProductID ProductType Promo
75 WB 1
84 WB 2
Then the order would be:
ProductID Quantity
75 3
84 2
The "ideal" mix of two products (as shown in the Survey
table) is possible because there are also two
Promo's, as shown in the Products table.
But if the Products table is:
ProductID ProductType Promo
84 WB 1
Then the order would be:
ProductID Quantity
84 5
There is only one Promo for this ProductType. Since the
store has space for 5 (Survey shows 3+2), five of this one
product is ordered.
Finally, if the Products table is:
ProductID ProductType Promo
75 WB 1
84 WB 2
27 WB 3
.... then the order is:
ProductID Quantity
75 3
84 2
There is not space for a third promo for this ProductType
in this store.
Get the general idea?
Right now I have the three tables loaded with data:
Products, Stores, Survey. I think that there must be a way
with queries to create my Orders table. (I don't know VBA
yet).
Is this not possible with queries?
Can someone give me a steer please? For instance I don't
even know whether to try to link the Survey table with the
others or not, and if so how....?
Art