S
scott
Hi,
I'm running MS Office Enterprise 2007 SP2, MS Sharepoint 2007 SP2 on
machines running Windows 2003 Enterprise.
My application is simple. I'm linked to several Sharepoint tables (or
lists) in a project via MS Access. I have a large table in Access that has
attachments and I'm trying to post the attachments to specific records in the
Sharepoint List.
In all my attempt I receive an error.
Run-Time error '3001'
Invalid Argument.
I've also used the code in this example, and get the same problem.
http://blogs.msdn.com/access/archive/2008/07/25/adding-attachments-from-a-folder.aspx
Now, I do get a different result if instead of saving the attachment to a
file on Sharepoint I save it locally to MS Access file; it works everytime
and the code is correct.
So what is up with Sharepoint and why is it different? And how can the code
be changed to work correctly in this environment?
---------- Code -------------
Dim rstParent As DAO.Recordset2
Dim rstChild As DAO.Recordset
Dim fldAttach As DAO.Field2
Dim Guiderst as DAO.recordset
' Guiderst is my table that I need to store my attachements.
' in Sharepoint.
' Attachments is my field in Sharepoint to save the attachment
' and I have a like name in the file that contains the actual
attachements
' get the attachment recordset and FileData field to contain
the file
Set rstChild = Guiderst.Fields("Attachments").Value
Set fldAttach = rstChild.Fields("FileData")
' add the attachment to the attachment field
rstChild.AddNew
' I've tried adding the fields data that has the attachment and
' letting it equal the data and also also tried reading it in
as in the
' example below.
fldAttach.LoadFromFile "C:\tmp\" & "4130X.pdf"
rstChild.Update
I'm running MS Office Enterprise 2007 SP2, MS Sharepoint 2007 SP2 on
machines running Windows 2003 Enterprise.
My application is simple. I'm linked to several Sharepoint tables (or
lists) in a project via MS Access. I have a large table in Access that has
attachments and I'm trying to post the attachments to specific records in the
Sharepoint List.
In all my attempt I receive an error.
Run-Time error '3001'
Invalid Argument.
I've also used the code in this example, and get the same problem.
http://blogs.msdn.com/access/archive/2008/07/25/adding-attachments-from-a-folder.aspx
Now, I do get a different result if instead of saving the attachment to a
file on Sharepoint I save it locally to MS Access file; it works everytime
and the code is correct.
So what is up with Sharepoint and why is it different? And how can the code
be changed to work correctly in this environment?
---------- Code -------------
Dim rstParent As DAO.Recordset2
Dim rstChild As DAO.Recordset
Dim fldAttach As DAO.Field2
Dim Guiderst as DAO.recordset
' Guiderst is my table that I need to store my attachements.
' in Sharepoint.
' Attachments is my field in Sharepoint to save the attachment
' and I have a like name in the file that contains the actual
attachements
' get the attachment recordset and FileData field to contain
the file
Set rstChild = Guiderst.Fields("Attachments").Value
Set fldAttach = rstChild.Fields("FileData")
' add the attachment to the attachment field
rstChild.AddNew
' I've tried adding the fields data that has the attachment and
' letting it equal the data and also also tried reading it in
as in the
' example below.
fldAttach.LoadFromFile "C:\tmp\" & "4130X.pdf"
rstChild.Update