Hi,
I have a form that displays an updated stock level for each product ID. The form is a Continuous form so
it displays more than one record. I need to change the InStock value in the table with the new values from the text1 field on the form.
I have a form that displays an updated stock level for each product ID. The form is a Continuous form so
it displays more than one record. I need to change the InStock value in the table with the new values from the text1 field on the form.
Basically [InStock] = [InStock] + Val(Text1)
You could put this in After Update event of text1.
I would suggest to prevent doublew updates, you also clear text1, so:
[InStock] = [InStock] + Val(Text1)
Text1 = 0
I am also assuming you have suitable properties set on text1 control, to ensure numbers and not letters are allowed etc
Hope this helps
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
Example: I have a form that contains 2 table. 'Products' table in the mainform and 'order details' in the subform(like Northwind). In the mainform i have a field Instock,a Unitorder field and a text1 field. In my subform i have a field quantity.
Formula:
text1=[unitorder]+[subform order detail quantity].
Instock=Instock(default value=0). Formula works!!
If i put the formula in Instock, it works too. But it just show the new value in the form and don't update it in the table (Instock is still 0). So i made a text1 field in the form with the formula in it. But i don't know how to update the value in text1 to Instock(in the table).
I hope that i explained it better now.
Is it possible to change/update a value from a field in a TABLE with a value from a field in a FORM with a code????
So in some appropriate event that fires when some significant item of data changes put code that does
Instock = Text1
That is how you do it.
HOWEVER
You cannot do text1=[unitorder]+[subform order detail quantity].
If there is more than one record in the subform then you have no way of defining which 'quantity' value will be added to UnitOrder
& if the subForm will only contain one record then it shouldn't be in a subForm
So you have a major problem with your structure that is beyond the question you are asking.
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.