cannot update record from MSHFlexgrid..help!!!
i want to update certain records from my mshflexgrid.
but i get the error "field cannot be updated".
Why??
this is my code to update:
VB Code:
Dim i
With mshRejLot
For i = 1 To rs.RecordCount
.TextMatrix(i, 0) = i
'mshRejLot.TextMatrix(i, 4) = Format(rs!amount, "dd/MM/yyyy")
.TextMatrix(i, 7) = Round(rs!amount, 2)
.TextMatrix(i, 8) = Round(rs!Origin_Cost, 2)
'rs.Find "rs!JOB_NO = '" & .TextMatrix(i, 2) & "'"
rs("AMOUNT") = Round(.TextMatrix(i, 7), 2)
rs("ORIGIN_COST") = Format$(Round(.TextMatrix(i, 8), 2), "Currency")
rs.Update
If .TextMatrix(i, 7) = "" Then
.Row = i
.Col = 7
.CellBackColor = vbRed
.Row = i
.Col = 8
.CellBackColor = vbRed
End If
Dim k
'For k = 1 To rs.RecordCount
'rs.Find "rs!JOB_NO = '" & .TextMatrix(i, 2) & "'"
rs.MoveNext
'Next k
Next i
End With
and this is my sql statement:
VB Code:
rs.Open "SELECT REJECT_LOT.PART_CODE, REJECT_LOT.JOB_NO, REJECT_LOT.SCRAP," & _
"REJECT_LOT.TRANS_DATE, REJECT_LOT.REASON,REJECT_LOT.DETAIL," & _
"(([REJECT_LOT].[SCRAP]/1000)*[Cost_Price].[Origin_Cost]) AS AMOUNT," & _
"Cost_Price.Origin_Cost FROM Cost_Price " & _
"RIGHT JOIN REJECT_LOT ON Cost_Price.Part_Code = REJECT_LOT.PART_CODE WHERE" & _
"(((REJECT_LOT.TRANS_DATE)BETWEEN #" & dari & "# And #" & hingga & "#)" & _
"AND ((REJECT_LOT.REASON)='DDI'))", conn, adOpenKeyset, adLockOptimistic
please HELP!!!!