write data into a field which is located on exact row number

J

jack

Hello, everyone. does anybody can help me out? I want to locate and write
data into the empty field which I konw is on 101 row. there are 5 rows need
be writen.
After debug the row number moved to 283 for some unkown reason.
Set db = CurrentDb
Set rs = db.OpenRecordset("master")
rs.MoveFirst
i = rs.Fields("id").Value
For i = 1 To 100
rs.MoveNext
Debug.Print rs.Fields("id").Value
Next i
Debug.Print rs.Fields("id").Value
For i = 101 To 105
Dim strFile As String
Dim strPath As String
Dim strPathNFile As String
strFile = "\" & rs.Fields("DWG_NAME")
strPath = rs.Fields("FILE_PATH")
strPathNFile = strPath + strFile
rs.Edit
If ReadBLOB(strPathNFile, rs, "IMAGE") Then 'stores the binary data
see modBlob for ReadBLOB function
rs.Update 'update the record
MsgBox "row"+ i + "Success!", vbInformation

Else
MsgBox strPathNFile & "does not exist!", vbExclamation

End If
rs.MoveNext

Next i
rs.Close
db.Close
MsgBox "Congrates All done!"
 
J

jack

Thanks a lot, Alex, I am still wonder how to sorting and I have an primary
key is "ID". What should I do? Would you please give me more detail? Have a
good one.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top