rs.Open "select *from purchasetable", cn, adOpenKeyset, adLockOptimistic
temp = 100
temp2 = Val(rs!Remaining)
rs.AddNew
rs!Name = Label6.Caption
rs!Quantity = Text1.Text
rs!Total = Label5.Caption
rs!MAXstock = 100
rs!Remaining = temp - Val(Text1.Text)
rs.Update
End Sub
you are subtracting temp(100) to the value of your text1.text
should it be temp2(your remaining items) minus the value in text1.text?