By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,557 Members | 1,406 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,557 IT Pros & Developers. It's quick & easy.

Sum database column for an ATM simulation

variouz3ckz
P: 18
we are required to do a simple atm machine-like, using vb6... that able user to deposit, withdraw and check balance...
my problem is... i cannot sum up the amount the user wants to deposit and the balance the user has in the database(im using MS ACCESS)

should i use number as its data type?!

plz help me guys...

im expecting your helpsss ASAP... tnx
Sep 22 '07 #1
Share this Question
Share on Google+
2 Replies


hariharanmca
100+
P: 1,977
we are .............
Ofcourse set Data type to number and at the bottom (General) FieldSize to Double then use a query like

Expand|Select|Wrap|Line Numbers
  1. Dim strSql As string
  2. strSql = "Select sum(amountField) As TotalAmount from tblTableName where userID = " & intUserId 
Sep 22 '07 #2

variouz3ckz
P: 18
Ofcourse set Data type to number and at the bottom (General) FieldSize to Double then use a query like

Expand|Select|Wrap|Line Numbers
  1. Dim strSql As string
  2. strSql = "Select sum(amountField) As TotalAmount from tblTableName where userID = " & intUserId 
ei i used this code, in the deposit but when i check the balance it end to error indicating that invalid use of null...

this is my code for DEPOSIT

Private Sub Command1_Click()
With Data1.Recordset


.Edit
str1 = balance + Val(txt_balance)
!balance = txt_balance
.Update

MsgBox "TRANSACTION SUCCESSFUL"

txt_deposit = ""
txt_deposit.SetFocus



End With
End Sub

and this is my code for check balance

Private Sub cmd_check_Click()
With Data1.Recordset

lbl_balance = !balance



End With

End Sub
Oct 1 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.