Results 1 to 8 of 8
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error 3052 (File sharing lock count exceeded) (Access 2003)

    Edited by HansV to provide link to MSKB article

    Hello,

    I've setup a script that builds a structured bill-of-material off of a flat file bill-of-material. Within the script is a section of code that re-sequences the 'Seq' (Double) field in the final table from a mixture of integers and rational numbers to integers only (see code below). My problem is, is that I receive an error 3052 after a approximately 30 seconds of running the code, and always get the error during the re-sequencing part of the script.

    I've read the Microsoft fix (<!mskb=815281>Microsoft Knowledge Base Article 815281<!/mskb>) and have modified the registry from 9500 to 25000, however I still get the error in approximately the same location (based off the progressbar). To allow the code to finish, I included a statement in the ErrHandler that says if err.number = 3052, then resume next. When running, the script pauses for a moment at the error location and resumes on. This doesn't seem right and I'm questioning if the output data is correct.

    1.) Is their a problem with the script below?
    2.) Is their a better way to re-sequence the recordset/table?
    3.) If not, what ramifications exist with ignoring the 3052 error (as I stated above)?

    'Sort and Re-sequence rstStructBom
    Set rstStructBom = dbs.OpenRecordset("SELECT * FROM TStudio_Layout_Bom ORDER BY Seq;", dbOpenDynaset)
    rstStructBom.MoveFirst
    Seq = 0
    Do While Not rstStructBom.EOF
    Forms!F_Progressbar.Status = "Building Level " & Level & vbCrLf & "Re-Sequencing"
    Forms!F_Progressbar.ProgressBar = rstStructBom.PercentPosition
    Forms!F_Progressbar.Form.Repaint
    Seq = Seq + 1
    temp = rstStructBom!Seq & " " & rstStructBom!Level & " " & rstStructBom!Item & " " & rstStructBom!Rev
    rstStructBom.Edit
    rstStructBom!Seq = Seq
    rstStructBom.Update
    rstStructBom.MoveNext
    Loop


    Thanks in advance for you help,
    Drew

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    I don't understand why this code would cause an error - I've run similar code on quite large tables without a problem. What happens if you reduce the code to the bare minimum:

    Set rstStructBom = dbs.OpenRecordset("SELECT * FROM TStudio_Layout_Bom ORDER BY Seq;", dbOpenDynaset)
    Seq = 0
    Do While Not rstStructBom.EOF
    Seq = Seq + 1
    rstStructBom.Edit
    rstStructBom!Seq = Seq
    rstStructBom.Update
    rstStructBom.MoveNext
    Loop

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    I still get the same error.

    Is their a better or faster way to handle the resequence?
    What implications exist if I ignore the error?

    Thanks,
    Drew

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    Frankly, I don't know what the consequences of ignoring the error are.

    Try this:

    - Create the following code in a standard module:

    Public lngSeq As Long

    Public Function Incr(anything) As Long
    lngSeq = lngSeq + 1
    Incr = lngSeq
    End Function

    - Create a query based on the table that sorts Seq in ascending order:

    SELECT Seq FROM TStudio_Layout_Bom ORDER BY Seq

    - Store this as qrySeq.

    - Use the following code to update Seq:

    lngSeq = 0
    CurrentDb.Execute "UPDATE qrySeq SET Seq = Incr([Seq])", dbFailOnError

  5. #5
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    Wow!!! This worked perfect and the speed is unreal. Maybe it took a second, if that. Compared to ~30 seconds with the recordset object.
    This is great, however I would prefer to have the query embedding within this script. Off hand, with out doing a little reading, I don't know how to do this. Would I start by using a querydef?

    Thank you very much for your help,
    Drew

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    You can create a query (QueryDef) in code - look up CreateQueryDef in the help.

  7. #7
    2 Star Lounger
    Join Date
    May 2002
    Location
    Quincy, Illinois
    Posts
    138
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    Hans,
    I can't seem to get this to work...

    Dim qdfSeq as DAO.QueryDef
    Set qdfSeq = dbs.CreateQueryDef("", "SELECT TStudio_Layout_Bom.Seq FROM TStudio_Layout_Bom ORDER BY TStudio_Layout_Bom.Seq;")
    ...
    lngSeq = 0
    CurrentDb.Execute "UPDATE qrySeq SET Seq = Incr([Seq])", dbFailOnError

    Do you know what am I doing wrong?
    Thanks,
    Drew

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Error 3052 (File sharing lock count exceeded) (Access 2003)

    You don't give the querydef a name.

    ' Create query qrySeq
    dbs.CreateQueryDef "qrySeq", "SELECT TStudio_Layout_Bom.Seq FROM TStudio_Layout_Bom ORDER BY TStudio_Layout_Bom.Seq;"
    ' Update Seq field
    lngSeq = 0
    dbs.Execute "UPDATE qrySeq SET Seq = Incr([Seq])", dbFailOnError
    ' Optional - delete query
    dbs.QueryDefs.Delete "qrySeq"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •