Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update Instock

Status
Not open for further replies.

firsttime

Technical User
Oct 1, 2002
22
0
0
NL
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.

Dan
 
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
 
Then bind the text1 control to the field in the table.

If text1 is unbound on a continuous form it will take on the same value regardless of which record it 'appears' to be in.

How are you calculating the value in text1 ?

It might be more convenient to do the calculation, then save that value to the table directly.


'ope-that-'elps.

G LS.


 
Hi again,

Maybe i didn't explain it right.

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????

I hope that you guys can help me,

THX IN ADVANCE
 
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.

G LS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top