Domanda

I'm using Access 2007 and Sharepoint 3.0. I've created a Sharepoint List in my db. Using VBA (below) I'm trying to 'copy' data from a field in the Sharepoint list to 'paste' into another field in my Access Db.

The code successfully runs up to the 'pasting' portion. I've confirmed all is good with a debug.print (the code is successfully copying the Sharpoint List data) but error 3421 pops up when 'pasting'.

Thank you in advance for anyone's help!

Dim rs_first As DAO.Recordset
Dim rs_end As DAO.Recordset
Dim tbl_start As String
Dim tbl_end As String

Dim rep As Variant
Dim proj As Variant
Dim hrs As Integer
Dim s_dt As Date
Dim e_dt As Date

tbl_start = "TEST_Resource" '<-- ***This is the Sharepoint List***
tbl_end = "MiddleTable"

Set rs_start = CurrentDb.OpenRecordset(tbl_start) 
Set rs_end = CurrentDb.OpenRecordset(tbl_end)

proj = rs_start.Fields("Projected Task")
rep = rs_start.Fields("Associate Name")
hrs = rs_start.Fields("Projected Hours")
s_dt = rs_start.Fields("Start Date")
e_dt = rs_start.Fields("End Date")

'Adding a Record to Table
        With rs_end
            .AddNew
                .Fields("ProjectName") = proj '<---***Error 3421****
                .Fields("Employee") = rep
                .Fields("Hours") = hrs
                .Fields("Week") = s_dt
            .Update
        End With
È stato utile?

Soluzione

This is a datatype conversion error. You need to ensure your rs_start.Fields("Projected Task") datatype is the same as rs_end.Fields("ProjectName"). Check the Type on each of these fields. If they are not the same you will need to cast accordingly.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top