i'm not sure whether this shud b in vb or sql but i'm havin a problem with updating the data in access using the sql commands in vb. It seems that it will not update but no error messages were shown. So i'm simply lost in verifying the error. Here is a sample for my code:
strDate = Format(txtInvoi ceDate.Text, "dd/mm/yyyy")
If saveType = 2 Then ' New Record
strSQL = "INSERT INTO tb_GTotalFL (InvoiceDate,Ac cNo,Discount,Ta x) " _
& "VALUES ('" & txtInvoiceDate. Text & "'," _
& "'" & txtAccNo.Text & "'," _
& "" & txtDiscount.Tex t & "," _
& "'" & txtTax.Text & "')"
Else
'Edit Record
strSQL = "UPDATE tb_GTotalFL SET Discount=" & txtDiscount.Tex t & ", " _
& " Tax=" & txtTax.Text & "" _
& " WHERE AccNo='" & txtAccNo.Text & "' AND InvoiceDate= #" & strDate & "#"
End If
' Open a connection using OLEDB.
cnn.ConnectionS tring = VDataFile
cnn.Open
Set rs = cnn.Execute(str SQL)
'close connection
Set rs = nothing
Set cnn = nothing
cnn.close
...no errors..but wont update record edited..can any1 advice..? help is very much appreciated
strDate = Format(txtInvoi ceDate.Text, "dd/mm/yyyy")
If saveType = 2 Then ' New Record
strSQL = "INSERT INTO tb_GTotalFL (InvoiceDate,Ac cNo,Discount,Ta x) " _
& "VALUES ('" & txtInvoiceDate. Text & "'," _
& "'" & txtAccNo.Text & "'," _
& "" & txtDiscount.Tex t & "," _
& "'" & txtTax.Text & "')"
Else
'Edit Record
strSQL = "UPDATE tb_GTotalFL SET Discount=" & txtDiscount.Tex t & ", " _
& " Tax=" & txtTax.Text & "" _
& " WHERE AccNo='" & txtAccNo.Text & "' AND InvoiceDate= #" & strDate & "#"
End If
' Open a connection using OLEDB.
cnn.ConnectionS tring = VDataFile
cnn.Open
Set rs = cnn.Execute(str SQL)
'close connection
Set rs = nothing
Set cnn = nothing
cnn.close
...no errors..but wont update record edited..can any1 advice..? help is very much appreciated
Comment