[VB6] problem in my query
im trying to do a simple vb6 application connected to mssql 2005 it runs fine since i try to subtract the value stored in my database in the value that i input here is my error
Code:
Private Sub cmdok_Click()
Dim con As New ADODB.Connection
'Dim com As New ADODB.Command
'Dim sql As String
Dim rec As ADODB.Recordset
con.ConnectionString = DBconnection
con.CursorLocation = adUseClient
con.Open
'com.ActiveConnection = con
'Set rec = com.Execute
If txtwithdraw = "" Then
MsgBox "You did't input any amount", vbCritical, "Error"
Else
txtwithdraw = Val(rec.Fields(0)) - Val(txtwithdraw)
'MsgBox "Have a good day", vbCritical, "Error"
End If
End Sub
what i intend to do is to subtract the value in field savings to the user inputed value and save it to database vb6 prompted this error "object variable or with block variable not set"
Re: [VB6] problem in my query
As the error pointed out, you haven't declared your variable/variables.