You do not hold data in forms, you hold it in tables, what you want to do is to update the table which conatins teh quantity of tools and on which frmTools is presumably based
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
First, there should be no need to deduct the quatity loaned out, you should be able to calculate the quantity 'onhand' from the data you have, using a query.
But assuming you insist on storing the data twice
base your issues form on a query joining the two tables
put both quantity columns on the form (the quantity on hand can be set visible = false if you do not want user to see it)
In the before update event on the form put
txtQuantityOnHand = txtQtyOnHand - txtQuantity
using your own control names of course
Alternativley you could keep FrmToolBookOut Form and in the after update event of the form execute an SQl update query, something like
Dim strSQL As String
strSQL = "UPDATE tblWhatever SET Quantity = Quantity + " & Me.Quantity & " WHERE StockCode = '" & Me.StockCode & "';"
DoCmd.RunSQL strSQL
again you need to subsitute your own control / column names, and if your stock code is anumber type ratehr than a string you do not need the ' surrounding it
Regards
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now -
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.