我正在针对链接到Sharepoint列表的MS Access 2010数据库运行一些VBA代码。代码循环通过记录集并在给定某些条件的情况下更新特定列。
当它在数据库中运行时,它是一个副本/未链接到实时共享点列表,当我逐步使用调试时,我可以看到数据库字段得到更新,而无需完成程序或退出调试。但是,当在链接模式下运行时,我无法通过调试来查看对行/列的更新。
这是预期的行为吗?反正有没有强制查看更新?我想在运行1k +更新之前确定这种行为是正确的。以下是我正在做的基本样本。基本上即使我已经步入下一个rst,我也无法在MS Access Table中看到先前第一个记录中“Notes Field”的更新。
Sub ListAttachments()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset2
Dim rsA As DAO.Recordset2
Dim fld As DAO.Field2
'Get the database, recordset, and attachment field
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("tblAttachments")
Set fld = rst("Attachments")
'Navigate through the table
Do While Not rst.EOF
'Get the recordset for the Attachments field
Set rsA = fld.Value
'Print all attachments in the field
Do While Not rsA.EOF
Debug.Print , rsA("FileType"), rsA("FileName")
rst.Edit
' Just and example I'm not actually put text below in
rst("Notes Field") = "This record has one or more attachments"
rst.Update
'Next attachment
rsA.MoveNext
Loop
rsA.Close
'Next record
rst.MoveNext
Loop
rst.Close
dbs.Close
Set fld = Nothing
Set rsA = Nothing
Set rst = Nothing
Set dbs = Nothing
End Sub
任何帮助表示赞赏!提前谢谢。