Sum database column for an ATM simulation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • variouz3ckz
    New Member
    • Jul 2007
    • 18

    Sum database column for an ATM simulation

    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
  • hariharanmca
    Top Contributor
    • Dec 2006
    • 1977

    #2
    Originally posted by variouz3ckz
    we are .............
    Ofcourse set Data type to number and at the bottom (General) FieldSize to Double then use a query like

    [CODE=vb]Dim strSql As string
    strSql = "Select sum(amountField ) As TotalAmount from tblTableName where userID = " & intUserId [/CODE]

    Comment

    • variouz3ckz
      New Member
      • Jul 2007
      • 18

      #3
      Originally posted by hariharanmca
      Ofcourse set Data type to number and at the bottom (General) FieldSize to Double then use a query like

      [CODE=vb]Dim strSql As string
      strSql = "Select sum(amountField ) As TotalAmount from tblTableName where userID = " & intUserId [/CODE]
      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 "TRANSACTIO N SUCCESSFUL"

      txt_deposit = ""
      txt_deposit.Set Focus



      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

      Comment

      Working...