Will you please help me to solve this problem..
this is the code..

Imports System.Data.OleDb

Public Class Form6
    Dim conn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim strSQL As String
    Dim dr As OleDbDataReader


    Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Database1.mdb")
        conn.Open()
    End Sub

    Private Sub enter6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles accept6.Click
      
        strSQL = "UPDATE ATM SET Balance_Inquiry = '" & Val(TextBox1.Text) - Val(Form4.balance.Text)
      
        If Val(TextBox1.Text) - Val(Form4.balance.Text) > TextBox1.Text Then
            MsgBox("Your Balance is insufficient to withdraw")
            TextBox1.Text = ""
            TextBox1.Focus()
        ElseIf TextBox1.Text < Form4.balance.Text Then
            Form4.balance.Text = Form4.balance.Text - TextBox1.Text
            Me.Hide()
            Form8.Timer1.Enabled = True
            Form7.Show()
        End If
        cmd = New OleDbCommand(strSQL, conn)
    
    End Sub

    Private Sub cancel6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancel6.Click
        Me.Hide()
        Form10.Show()
        Form1.pinenter.Text = ""

Just be carefull when operating values.

An string can not be included in any math operation.

On your piece of code you must change som things:

Imports System.Data.OleDb

Public Class Form6
    Dim conn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim strSQL As String
    Dim dr As OleDbDataReader


    Private Sub Form6_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|\Database1.mdb")
        conn.Open()
    End Sub

    Private Sub enter6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles accept6.Click
      
        strSQL = "UPDATE ATM SET Balance_Inquiry = '" & Val(TextBox1.Text) - Val(Form4.balance.Text)
      
        If Val(TextBox1.Text) - Val(Form4.balance.Text) > Val(TextBox1.Text) Then
            MsgBox("Your Balance is insufficient to withdraw")
            TextBox1.Text = ""
            TextBox1.Focus()
        ElseIf Val(TextBox1.Text) < Val(Form4.balance.Text) Then
            Form4.balance.Text = (Val(Form4.balance.Text) - Val(TextBox1.Text)).ToString
            Me.Hide()
            Form8.Timer1.Enabled = True
            Form7.Show()
        End If
        cmd = New OleDbCommand(strSQL, conn)
    
    End Sub

Hope this helps

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.