943,970 Members | Top Members by Rank

Ad:
Oct 30th, 2009
0

Subtracting from database

Expand Post »
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)
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ivankenny is offline Offline
4 posts
since Oct 2009
Oct 30th, 2009
0
Re: Subtracting from database
So you are using the ADODC (ActiveX Data Objects Data Control) right???
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. adodc1.Recordset.Update



Good Luck
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Oct 31st, 2009
1
Re: Subtracting from database
Try the following -

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  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

Hope this solves your problem.
Reputation Points: 329
Solved Threads: 347
Senior Poster
AndreRet is offline Offline
3,700 posts
since Jan 2008
Nov 1st, 2009
0
Re: Subtracting from database
Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1.  
  2. 1. Dim x as Integer, y as Integer, z as Integer
  3. 2. x = Val(txtQan.Text)
  4. 3. y = Val(txtSalesQan.Text)
  5. 4. z = x - y
  6. 5.
  7. 6. rsQan!Qauntity = z
  8. 7. rsQan.Update
  9. 8. 'rsQan is your recordset
  10. 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
Last edited by ivankenny; Nov 1st, 2009 at 7:57 pm.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ivankenny is offline Offline
4 posts
since Oct 2009
Nov 2nd, 2009
0
Re: Subtracting from database
Only a pleasure dude. Hope you get to the ultimate!!!
Reputation Points: 329
Solved Threads: 347
Senior Poster
AndreRet is offline Offline
3,700 posts
since Jan 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: College library system
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: visual basic





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC