I've tried doing it without the if statement and the variable, but the same thing occurs. Help?
Dim DateUpdate As String
If IsDate(dtpPaymentDate.Text) Then
DateUpdate = dtpPaymentDate.Text
Else
DateUpdate = Date.Today
End If
sql = "UPDATE tblOutstanding SET AmountPaid = " & CInt(Outstanding.txtAmountPaid.Text) & _
" WHERE InvoiceNumber = " & CInt(txtInvNumber.Text) & ";"
sql1 = "UPDATE tblOutstanding SET BalanceDue = " & CInt(Outstanding.txtBalDue.Text) _
& " WHERE InvoiceNumber = " & CInt(txtInvNumber.Text) & ";"
sql2 = "UPDATE tblOutstanding SET LastPayment = " & DateUpdate _
& " WHERE InvoiceNumber = " & txtInvNumber.Text & ";"
Dim UpdateAmountPaid As New OleDb.OleDbCommand(sql, con)
Dim UpdateBalanceDue As New OleDb.OleDbCommand(sql1, con)
Dim UpdateLastPayment As New OleDb.OleDbCommand(sql2, con)
con.Open()
MsgBox(con.State.ToString)
UpdateAmountPaid.ExecuteNonQuery()
UpdateBalanceDue.ExecuteNonQuery()
UpdateLastPayment.ExecuteNonQuery()
con.Close()
dgPopulate()
MessageBox.Show("Database Updated")
Me.Close()

New Topic/Question
Reply


MultiQuote






|