Tell me more ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I found this link which is very similar to what I need to do. It explains how to append to a SharePoint append only field using C#. Is there a way to do the same thing with VBA?

Can you add comments to an append-only field in a list in Sharepoint 2010 using C#?

I can use the following connection string below to write to other fields but not the field that is Append Only with versioning turned on:

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = Application.CurrentProject.Connection
Set rs = New ADODB.Recordset
Dim strRS As String
strRS = "SELECT qryJD_SRs.* FROM qryJD_SRs WHERE qryJD_SRs.ID=" & Me.ID

rs.Open strRS, cn, adOpenKeyset, adLockOptimistic

This line of code works to write data to a field:

rs.Fields("Details").Value = "Test Details Field"

This line of code does not work:

rs.Fields("Actions Taken").Value = "Test Actions Taken Field"

Both the [Details] and the [Actions Taken] fields are Memo and Rich Text. The [Actions Taken] field is Append Only = Yes

Per Jakobsen's response to the post above apparently works for C#. Is there a ways to do the same with VBA? Thanks...JD

I have since attempted to do the same thing using DAO:

Using DAO, I can write to a field:

Private Sub addNewAction_Click()
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM [Service Requests] WHERE [Service Requests].ID = " & Me.ID
Set rs = DBEngine(0)(0).OpenRecordset(strSQL, dbOpenDynaset)

With rs
.Edit
![Details] = "Monday test"
.Update
End With

rs.Close
Set rs = Nothing
End Sub

But using DAO I CANNOT write to the Append Only field with the string below:

Private Sub addNewAction_Click()
Dim rs As DAO.Recordset
Dim strSQL As String
strSQL = "SELECT * FROM [Service Requests] WHERE [Service Requests].ID = " & Me.ID
Set rs = DBEngine(0)(0).OpenRecordset(strSQL, dbOpenDynaset)

With rs
.Edit
![Actions Taken] = "Monday test"
.Update
End With

rs.Close
Set rs = Nothing
End Sub

Any suggestions?...JD

share|improve this question
I have since learned that I should use Recordset2 and I'm told that I must also use Field2. Can someone provide me with some help?...JD – John Durbin Aug 21 '12 at 14:08

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.