Table records updation from Excel Sheets
Hi All
I hope every enjoying this forum and nice day
Problem Statement
Table ABC imports data from Excel sheet every week when prices(field) changes, now i have to update only those record which is change in a week so not every record updated.
itemno itemname itemprice
001 XXXX 1.1
if itemprice changes it will update record otherwise no change
At the moment i am doing this which is ok but not looks good
r.Open "ExcelSheetLinkTable", CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly
t.Open "AccessTable", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
'Updateing record into Access table BOMTestData if its not new
Do While Not r.EOF And Not t.EOF
If Nz(r!f1, "") <> "" And Nz(r!f2, "") <> "" And Nz(r!f4, "") <> "" Then
If r!f2 >= 1 Then
If t!Price <> r!f4 Then
't.AddNew
t!SXID = r!f8
t!PID = r!f1
t!MinQuan = r!f2
t!Currency = r!f3
t!Price = r!f4
t.Update
Else
'Error
End If
Else
'Error
End If
Else
'Error
Exit Do
End If
t.movenext
r.movenext
Loop
|