Dear all,
Saya mempunyai permasalahan mengenai update dari recordset ke tabel. Berikut
listing codingnya
Private Sub Form_Load()
rsSelect.open "SELECT
a.ServiceID,b.ServiceName,a.ServiceDetailID,a.ServiceDetailName,a.AmountUSD,a.AmountIDR,a.Invoice,a.DateReceive,b.Type
FROM tbServiceDetail a INNER JOIN tbService b ON
a.ServiceID=b.ServiceID", Con
With rsSelect
While Not .EOF
Set lstItem = lvService.ListItems.Add(, ,
.Fields("ServiceDetailName"))
lstItem.SubItems(1) = .Fields("ServiceName")
lstItem.SubItems(2) = .Fields("AmountUSD")
lstItem.SubItems(3) = .Fields("AmountIDR")
lstItem.SubItems(4) = .Fields("Invoice")
lstItem.SubItems(5) = Format(.Fields("DateReceive"), "DD-MM-YYYY")
lstItem.SubItems(6) = .Fields("Type")
.MoveNext
Wend
End With
End Sub
misalkan hasil join tersebut ada beberapa record, kemudian rsSelect tersebut
saya update.
Private Sub cmdUpdate_Click()
rsSelect.Fields("AmountUSD").Value = Val(txtAmountUSD.Text)
rsSelect.Fields("AmountIDR").Value = Val(txtAmountIDR.Text)
rsSelect.Fields("Invoice").Value = txtInvoice.Text
End Sub
lalu hasil update dari rsSelect tersebut saya insert ke dalam sebuah tabel
Private Sub cmdOk_Click()
rsSelect.MoveFirst
With rsSelect
While Not .EOF
rsInsert.Open "INSERT INTO tbTransactionDetail
(TransID,ServiceID,ServiceDetailID,AmountUSD,AmountIDR,Invoice) VALUES (" & cID
& "," & rsSelect.Fields ("ServiceID") & "," &
rsSelect.Fields("ServiceDetailID") & "," & rsSelect.Fields("AmountUSD") & "," &
rsSelect.Fields("AmountUSD") & ",'" & rsSelect.Fields
("Invoice") & "')",Con
.MoveNext
Wend
End With
End Sub
kemudian muncul error "Insufficient key column information for updating or
refreshing". Error-nya terletak di tulisan yg warna merah. Kira2 apa ya
masalahnya.
thanks,
ddw