Originally Posted by
aytee111
You're welcome.
The items table comes into play in two different scenarios:
1 - a quote that is added using an opportunity. User will select an OppID from OppHeaderT, then click Add New, and all the records on OppDetailT with this OppID will be copied to ItemsT to create the line items for the quote (as in post # 4) - code already posted to do this
2 - a quote that is not based on an opportunity - user will add a new quote (QuoteHeaderT) and will begin entering line items for this quote (ItemsT).
The same form will allow the user to select a quote from an existing list (combobox) and the form will display that quote information from the header along with a subform that will contain all the items for that quote ID. Your confusion comes in because QuoteID is missing from ItemsT.
OppHeader to OppDetail - one to many (many items belong to one Opp, as in post # 4)
OppHeader to QuoteHeader - one to many (the same OppID wlll be used over and over for multiple quotes)
QuoteHeader to Items - one to many (one quote will contain many line items)
OppDetail to Items - one to many (one OppDetail record will appear multiple times on different quotes, same as Oppheader to QuoteHEader)
The two Opp tables are considered to be static tables, i.e. they never change (except for maintenance that is seldom done). The two quote tables are transaction tables, records are continually being added and/or changed. So picture this, when you create a quote from an Opp you need all of those OppDetail lines to show up - and then you want to make changes, such as quantity, price, etc. You definitely do not want to make those changes to the OppDetail table, that must never change, it must be kept pristine for the next quote to use it. So you need somewhere to store the data, which is your ItemsT.