Hello it's me again i'm having problem with the database subtraction for my POS Project im using ado database and i know that you just have to change the value from the selected and voila it would update the database but mine doesnt work:


' txtqan is connect to the item database
txtqan.text = Val(txtqan.text) - Val(txtsalesqan.text)

So you are using the ADODC (ActiveX Data Objects Data Control) right???

adodc1.Recordset.Update

Good Luck

Try the following -

Dim x as Integer, y as Integer, z as Integer
x = Val(txtQan.Text)
y = Val(txtSalesQan.Text)
z = x - y

rsQan!Qauntity = z
rsQan.Update
'rsQan is your recordset
'Qauntity is your field name

Hope this solves your problem.

commented: thx for the help +0
1.  Dim x as Integer, y as Integer, z as Integer
   2.  x = Val(txtQan.Text)
   3.  y = Val(txtSalesQan.Text)
   4.  z = x - y
   5.       
   6.  rsQan!Qauntity = z
   7.  rsQan.Update
   8.  'rsQan is your recordset
   9.  'Qauntity is your field name

thx for the help i just change the code a little bit and it work just add .recordset to make it work for my system thx here the new code:

1. Dim x as Integer, y as Integer, z as Integer
2. x = Val(txtQan.Text)
3. y = Val(txtSalesQan.Text)
4. z = x - y
5.
6. rsQan.recordset!Qauntity = z
7. 'rsQan is your recordset
8. 'Qauntity is your field name

Only a pleasure dude. Hope you get to the ultimate!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.