I'm designing a small stock control system with 2 tables: Item table composed of: itemid, itemname and quantityonhand. Transaction table composed of: TransID, itemid, TranCode (IN, Out), quantity and date of transaction. I designed a form consisting mainly of a combobox based on the Item table. The combo box displays the ItemName of all items in the table and the ItemID which is hidden. then there is a textbox where a user enters the Quantity and another for the date and a third for the Trans code. The system should work like this: User selects an item from the combobox, enters quantity, date and trans code. A record is added to the transaction table, and the corresponding record in the Item table is updated by either adding to or subtracting from the quantityonhand depending on the Trans code.
My problem is I failed to write the correct code for linking the selected item from the combobox to the corresponding record in the Item table.