attaching a file to a sharepoint record

  • Thread starter Thread starter Eric
  • Start date Start date
E

Eric

what is the best way to do this using VBA inside access 2007? The sharepoint
record "tickets" is linked. I've tried the loadtofile function with the
following code and get "invalid argument" at that line.

'Save files to sharepoint
Set rst = db.OpenRecordset("Tickets")
Do Until rst.EOF
If rst!TicketNr = newWO Then
Set rst1 = rst.Fields("Attachments").Value
Y = 1
Do Until Y = z - 1
strFile = "C:\" & Files(Y)
rst.Edit
rst1.AddNew
rst1.Fields("FileData").LoadFromFile strFile
rst1.Update
rst.Update
Y = Y + 1
Loop
rst1.Close
End If
rst.MoveNext
Loop
rst.Close
 
I've never worked with the Attachments field in Sharepoint, but the first
question that comes to mind is:

Where does the value of Z come from in:

Do Until Y = z - 1
 
Back
Top