2015-10-20 56 views
0

我一直在为一组工作中的相当复杂的访问数据库工作。数据库完全是在Access 2010中设计的,并且工作得很好。然后,我将所有表推送到SharePoint 2013并将它们链接回数据库。使用更新查询运行一段代码时,我现在收到错误消息。它表示由于锁定违规而无法更新更新查询中的所有记录。我已经检查并且在SharePoint中关闭了版本控制。建立数据库是为了让用户可以在表格中搜索与他们需要输入的内容相匹配的记录,并将旧记录“复制”到他们正在创建的新记录中。使用这种设计,表单和子表单都从同一个表中提取,我认为这可能是问题,但在将表推送到SharePoint之前,它在Access中运行良好。有没有人对我如何解决这个问题有任何想法?谢谢!连接到Sharepoint表的访问数据库

这是我认为导致问题的代码。这个特殊的错误并没有给我选择调试,所以我不确定。 私人小组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

如果其他人有类似的问题,我能重写代码来创建一个记录,使用记录能够设置记录属性.LockEdits =假

我希望这有助于别人在某个时候,因为似乎有很多人有问题,没有解决!