設(shè)為首頁收藏本站Access中國

Office中國論壇/Access中國論壇

 找回密碼
 注冊(cè)

QQ登錄

只需一步,快速開始

返回列表 發(fā)新帖
查看: 2529|回復(fù): 2
打印 上一主題 下一主題

[Access本身] 這段代碼為什末出現(xiàn)"文件共享鎖定數(shù)溢出3052"錯(cuò)誤

[復(fù)制鏈接]
跳轉(zhuǎn)到指定樓層
1#
發(fā)表于 2005-5-16 19:11:00 | 只看該作者 回帖獎(jiǎng)勵(lì) |倒序?yàn)g覽 |閱讀模式
Public Function abc()
On Error GoTo Err_Cmdls_Click
CurrentDb.Execute "update 電視劇整理 set 臨時(shí)=''"
    Dim Rs As New ADODB.Recordset
    Dim date1 As Date
    Dim date2 As Date
    Dim str1 As String
    Dim str2 As String
    Dim xx1 As String
    Dim xx2 As String
    Dim mc1 As String
    Dim mc2 As String
    Rs.Open "電視劇整理", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
    Rs.MoveFirst
    CurrentDb.Execute "update 電視劇整理 set 臨時(shí)=名稱 "
    Do Until Rs.EOF
    str1 = Rs!臨時(shí)
    date1 = Rs!開始日期
    xx1 = Rs!合并
    mc1 = Rs!名稱
    Rs.MoveNext
    mc2 = Rs!名稱
    xx2 = Rs!合并
    date2 = Rs!開始日期
    If xx1 = xx2 And date2 - date1 > 10 Then
    str2 = str1 + "-重"
    Rs!臨時(shí) = str2
    ElseIf xx1 = xx2 And date2 - date1 <= 10 Then
    Rs!臨時(shí) = str1
    Else
    Rs!臨時(shí) = mc2
    End If
    Loop
Rs.Close
Set Rs = Nothing
Exit_Cmdls_Click:
    Exit Function

Err_Cmdls_Click:
  If err.Number = 3021 Then
  MsgBox "結(jié)果已經(jīng)生成!", vbInformation, "提示:"
  Resume Exit_Cmdls_Click
  End If
    MsgBox err.Description & err.Number
    Resume Exit_Cmdls_Click
   
End Function
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享分享 分享淘帖 訂閱訂閱
2#
發(fā)表于 2005-5-16 20:34:00 | 只看該作者
最好是附上數(shù)據(jù)庫

點(diǎn)擊這里給我發(fā)消息

3#
發(fā)表于 2005-5-19 06:55:00 | 只看該作者

這段代碼為什末出現(xiàn)"文件共享鎖定數(shù)溢出3052"錯(cuò)誤

有兩個(gè)方法解決:

1.修改注冊(cè)表 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Jet\3.5\Engines\Jet 3.5 (如果是4.0版本改為4.0) 將MaxLocksPerFile改到足夠大 (但注意也不要太貪心

2.在運(yùn)行你的程序之前運(yùn)行下面的函數(shù):
Sub LargeUpdate()
      On Error GoTo LargeUpdate_Error
      Dim db As Database, ws As Workspace

      ' Set MaxLocksPerFile.
      DBEngine.SetOption dbMaxLocksPerFile, 200000

      Set db = CurrentDb
      Set ws = Workspaces(0)

      ' Perform the update.
      ws.BeginTrans
      db.Execute "UPDATE LargeTable SET Field1 = 'Updated Field'", _
         dbFailOnError
      ws.CommitTrans

      db.Close
      MsgBox "Done!"
      Exit Sub

   LargeUpdate_Error:

      MsgBox Err & " " & Error
      ws.Rollback
      MsgBox "Operation Failed - Update Canceled"
      Exit Sub

   End Sub
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則

QQ|站長郵箱|小黑屋|手機(jī)版|Office中國/Access中國 ( 粵ICP備10043721號(hào)-1 )  

GMT+8, 2024-10-23 10:24 , Processed in 0.101094 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回復(fù) 返回頂部 返回列表