469,955 Members | 1,473 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,955 developers. It's quick & easy.

When inventory is not yet sold

40 32bit
Intro:

I am still (painfully) trying to create a sportscard database. I have other questions related to this endeavor in other threads in this forum.

Background:

I need to database to be able to store Order data (items I buy) and Sales data (items I sell).
One Order can later be part of many Sales (i.e. many items can be bought in one Order transaction and be split up later into multiple Sale transactions. The same is true for sales - One Sale transaction can be related to multiple Order transactions. This leads me to create a many to many junction table labeled TBL_InventoryTransactions.

TBL_Sales
PK_Sale ID (auto#)
SaleDate
SaleAmount

TBL_Orders
PK_Order ID (auto#)
OrderDate
OrderAmount

TBL_InventoryTransactions
PK_InventoryID (auto#)
Item Description
FK_OrderID
FK_SaleID

Help:
Access requires that a Sale ID record exist in the TBL_Sales as part of the many to many relation when entering data into the TBL_InventoryTransactions. How can this be handled since there will be times when Orders and subsequently Inventory do not have a corresponding Sale transaction yet?

As always, thank you for all your help for anyone who wishes to jump in. I will add an image or the relation after submitting as I cannot easily find where the manage attachments button is located.

3 Weeks Ago #1
7 11125
NeoPa
32,233 Expert Mod 16PB
It seems as if your Inventory data is being forced into restrictions that don't necessarily pertain. Essentially TBL_InventoryTransactions is both a container for stock held as well as a M2M linking these with sales & orders. As you've just told us this is not reliably true, I suggest you need a table to handle your inventory as well as two M2M tables - one each to handle the sales v inventory relationship and the order v inventory relationship. Only records that represent actual relationships would need to be created. IE. You could have inventory records with links to sales &/or orders or you could have some without either.

It's hard to know if that matches your requirement very closely but certainly the idea of mandatory links when none exist - simply in order to represent stock that does exist - is not a design that can work for what you say you want.
3 Weeks Ago #2
cmo187265
40 32bit
As always Neopa, thanks for your help.

Are you suggesting to create 2 MTM Juntions, one between TBL_InventoryTransactions & TBL_Sales as well as one between TBL_InventoryTransactions & TBL_Orders?

I don't have Inventory as having a MTM with either Order or Sales because each item in inventory is a unique item. A card is appraised/graded, encased by a grader, and then stamped with a unique barcode that doesn't duplicate.

Thanks again.
3 Weeks Ago #3
NeoPa
32,233 Expert Mod 16PB
Happy to help where I can :-)

What I'm suggesting really is that you design the structure to match the reality of what you have and are managing. Your explanation doesn't clarify that for me I'm afraid.

For each individual item of inventory :
  1. Can it have multiple related sales?
  2. Can it have no related sales?
  3. Can it have multiple related orders?
  4. Can it have no related orders?
I assume that each sale & each order are able to be associated with multiple items of inventory.
The answers to these questions will determine how your tables are designed.
3 Weeks Ago #4
cmo187265
40 32bit
Thank you Neopa. Sorry I was not clear perhaps.

One order can contain many inventory items, one sale can also contains many inventory items.

Concerning 1 unique inventory item:
Can it have multiple related sales? - NO
Can it have no related sales? - YES
Can it have multiple related orders? - NO
Can it have no related orders? - NO

So when I enter an order transaction I will simultaneously be entering a unique one of a kind item into inventory. This item is serial numbered as unique and will only ever 1) sit in inventory or 2) be sold.

My original design assumed Sales and Orders needed to be relationed in order to run a query to sum transaction values between to the two to arrive at a profit report.

I would like the ability eventually to be able to query those items that are not sold, by some certain parameters, to give lists to collectors based on certain players or years of card they may be collecting. This may be a topic for another thread but I like to try myself before overthinking or not understanding and ultimately posting to the forum.

Thanks again...I wish I wasn't so slow to grasp this stuff...
3 Weeks Ago #5
cmo187265
40 32bit
I believe I found a solution by reading through another person's similar issue on another forum.

It is likely against etiquette to post a link to another forum but the solution is to clear out what Access autopopulates as 0 in the default value property in the field of the TBL_Sales that is located as a FK in the TBL_InventoryTransactions.
2 Weeks Ago #6
NeoPa
32,233 Expert Mod 16PB
I swear I replied to this since post #5 but I see no signs of it. It must never have made it to post. Apologies for that. I'll have a look again tomorrow when I have more time. I remember thinking post #5 was well done and included the important information.

Certainly you're right about the etiquette (and explicit rules to that effect as well in fact) so your reply was well done.
2 Weeks Ago #7
cmo187265
40 32bit
No problem NeoPa. I can assure you that I continue to chase rabbits that are at least initially relevant to my questions while waiting for replies so I'm no just waiting idly.

Makes sense about external links so that the body of knowledge can grow within the forum.

Look forward to any feedback on my posts #5 or #6 when you have time.

Thanks as always.
1 Week Ago #8

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by simon | last post: by
9 posts views Thread by Frank Ruffolo | last post: by
2 posts views Thread by angel duran | last post: by
2 posts views Thread by DS | last post: by
2 posts views Thread by Stella Pieters via AccessMonster.com | last post: by
2 posts views Thread by ChriS99 | last post: by
2 posts views Thread by pkfloyd | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.