Subtracting from database

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Oct 2009
Posts: 3
Reputation: ivankenny is an unknown quantity at this point 
Solved Threads: 0
ivankenny ivankenny is offline Offline
Newbie Poster

Subtracting from database

 
0
  #1
Oct 30th, 2009
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)
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 893
Reputation: vb5prgrmr will become famous soon enough vb5prgrmr will become famous soon enough 
Solved Threads: 167
vb5prgrmr vb5prgrmr is offline Offline
Practically a Posting Shark
 
0
  #2
Oct 30th, 2009
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
If anyone has helped you solve your problem, please mark your thread as solved.

Thanks
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 255
Reputation: AndreRet is an unknown quantity at this point 
Solved Threads: 38
AndreRet AndreRet is offline Offline
Posting Whiz in Training
 
1
  #3
Oct 31st, 2009
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.
Please mark questions as answered when done.

Be the ONE!!!
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 3
Reputation: ivankenny is an unknown quantity at this point 
Solved Threads: 0
ivankenny ivankenny is offline Offline
Newbie Poster
 
0
  #4
Nov 1st, 2009
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.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 255
Reputation: AndreRet is an unknown quantity at this point 
Solved Threads: 38
AndreRet AndreRet is offline Offline
Posting Whiz in Training
 
0
  #5
Nov 2nd, 2009
Only a pleasure dude. Hope you get to the ultimate!!!
Please mark questions as answered when done.

Be the ONE!!!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



Tag cloud for Visual Basic 4 / 5 / 6
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC