我一直在为一个正在工作的小组开发一个相当复杂的访问数据库。该数据库完全在Access 2010中设计,运行良好。然后,我将所有表推送到SharePoint 2013并将它们链接回数据库。我在运行带有更新查询的代码段时遇到错误。它说它由于锁定违规而无法更新更新查询中的所有记录。我已检查并在SharePoint中关闭版本控制。构建数据库是为了使用户可以搜索表以查找他们需要输入的内容,并将旧记录“复制”到他们正在创建的新记录中。使用这种设计,表单和子表单都从同一个表中提取,我认为这可能是问题,但在将表推送到SharePoint之前,它在Access中运行良好。有没有人对如何解决这个问题有任何想法?谢谢!
以下是我认为导致此问题的代码。那个特定的错误没有给我调试的选项,所以我不确定。 Private Sub Command165_Click()
Dim SQL As String
Me.Dirty = False
SQL = "UPDATE [Cross_Border_Grid_Table]" _
& "SET [Export Country]='" & Me.[Export Country] & "', [Export State]='" & Me.[Export State] & "', [Export City and/or Providence]='" & Me.[Export City and/or Providence] & "', [Import Country]='" & Me.[Import Country] & "', [Import State]='" & Me.[Import State] & "', [Import City and/or Providence]='" & Me.[Import City and/or Providence] & "', " _
& "[Shipment Type]='" & Me.[Shipment Type] & "', [Material Category]='" & Me.[Material Category] & "', [Sub Category]='" & Me.[Sub Category] & "', [Specific Material]='" & Me.[Specific Material] & "', [Transgenic/ Conventional]='" & Me.[Transgenic/ Conventional] & "', [Intended Use]='" & Me.[Intended Use] & "', " _
& "[Specific Use]='" & Me.[Specific Use] & "', [Material Common Name]='" & Me.[Material Common Name] & "', [Scientific Name]='" & Me.[Scientific Name] & "', [Event]='" & Me.[Event] & "', [Material Condition]='" & Me.[Material Condition] & "', [Permit Required]='" & Me.[Permit Required] & "', " _
& "[Phytosanitary Certificate Required]='" & Me.[Phytosanitary Certificate Required] & "', [Agency Labels]='" & Me.[Agency Labels] & "', [Other Requirements]='" & Me.[Other Requirements] & "', [Data Modified]='" & Me.[Data Modified] & "', [RegCode]='" & Me.[RegCode] & "' WHERE [ID] = " & [Forms]![New_Shipment_Home_frm]![Text105]
DoCmd.RunSQL SQL
答案 0 :(得分:0)
如果其他人有类似的问题,我能够重写代码来创建记录集,并且使用记录集能够将记录集属性设置为.LockEdits = False
我希望这会在某些时候对其他人有所帮助,因为似乎有很多人遇到了问题而且没有解决方案!