Further to your latest post, please find below a list of all tables
Tables
Component ID (PK)
PEXPID (FK)
Procode
Inventory
LogID (PK)
Item
Description
Category
Location
Cost
Reorder
TargetStock
Attachments
Discontinued
Comments
Sizincm
Inventory Transactions
TransID (PK)
Transaction Item
Employee
Transaction Type
Quantity
Created Date
POnumber
Comments
Logs
KeyID (PK)
Date
Time
Notes
Temperature
PHRange
Amonia
Nitrate
Nitrite
AmendStock (SEE NOTE)
TransactionID (I need to record the transaction id here) Not sure how to
(AmendStock) Notes
Option Compare Database
Private Sub AmendStock_AfterUpdate()
DoCmd.Close acForm, "OtherForm"
If Me.AmendStock = -1 Then
DoCmd.OpenForm "Inventory Transactions Form", , , , acFormAdd
DoCmd.Close acForm, "Inventory Transactions"
End If
End Sub
PEXP
PEXPID (PK)
ProdCode
CompQTY
Transaction Types
ID (PK)
Description
Add/Remove
The main purpose of this database is to maintain the log of all activity relating to our tropical fish tank. Looking at the log table I have created a form from the log table, this form is the main data input form, the temperature, PH range, ammonia, nitrate, nitrite, are all numerical fields.
I have recently added an amend stock yes or no field to the LogForm to enable me to make changes two Stockfile. When a tick is placed in the amend stock field, the inventory transaction form opens and allows me to make any changes to the stock.
Once I have amended the stock I make a note of the transaction number and enter it into the transaction ID on the LogForm, I know that this is not ideal but I have yet to find out how to write the transaction ID back to the log form.
Now back to the PEXP and components table, all of the product codes and components are items in the inventory Table/Form. PEXP holds product code and description, and the components subform holds PEXPID foreign Key, along with a list of components and quantity’s required for the main product. For example-:
WC0001 is the product. 25% WATER CHANGE is the description of this product.
002001 is the component code WATER PER LITRE is the companion description 60 is the component quantity.
001006 is the component code AQUA SAFE PER ML is the component description 30 is the components quantity
Z88049 is the component code WOOL FILTER CHANGE is the companion description 1 is the components quantity.
So from the above list, we can see that a 25% the water change requires three individual components, reducing stock of those components by 91 Pcs.
With reference to my earlier notes the amend stock feature only allows me to update one component per log id, which up until now has been fine,
Ideally, what I require in this example, is that the product code WC001 25% water change increases in quantity by one, (which technically the receipt of the product) and all of the components reduce by the quantity required, in this case three individual components reducing the stock quantity by 91 pieces. (this technically is the usage of components) and then finally decrease the product code WC 001 by one for (which is technically the usage of the main product) this part is just as important as it maintains the stock quantity for WC 001 at zero.
Please let me know if you require any further information, or explanation as to how the kit/parts explosion works.
David.