2015-10-20 57 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 =假

我希望這有助於別人在某個時候,因爲似乎有很多人有問題,沒有解決!