Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2002

    Angry Unanswered: How do I unlock a table

    I have an audit program that analyzes 5 sets of data. It runs 1st set then when it runs the 2nd set it craps out on a particular function. I get an error:

    The database engine could not lock table 'ADJSYSCorrections' because it is already in use by another person or process.

    How can I release the lock on this table from when it runs throught analysis on the 2st set of data. The following is an abbreviated version of my code:

    Function TestADJSYS(ADJSYSMaster As String, ADJSYS As String)

    Dim dbs As Database
    Dim recADJSYS As Recordset
    Dim recADJSYSMaster As Recordset
    Dim tdf As TableDef
    Dim fld As Field
    Dim FieldChanged As Boolean
    Dim Check1, Check2, Check3, Check4, Check5, Check6, Check7, Check8, _

    Check9, Check10, Check11, Check12 As Boolean
    Dim Field1, Field2, Field3, Field4, Field5, Field6, Field7, Field8, _

    Field9, Field10, Field11, Field12 As String
    Dim m As Integer

    Set dbs = CurrentDb
    Set recADJSYSMaster = dbs.OpenRecordset(ADJSYSMaster)
    Set recADJSYS = dbs.OpenRecordset(ADJSYS)
    Set tdf = dbs.TableDefs(ADJSYSMaster)

    dbs.TableDefs.Delete "ADJSYSCorrections"
    dbs.Execute ("CREATE TABLE ADJSYSCorrections(Field1 TEXT, Field2 TEXT, Field3 TEXT, Field4 TEXT, Field5 TEXT, Field6 TEXT, Field7 TEXT, Field8 TEXT, Field9 TEXT, Field10 TEXT, Field11 TEXT, Field12 TEXT);")

    --My Code--

    20 recADJSYSMaster.Close


    Set dbs = Nothing

    End Function

    I've tried closing and reopening the dbase but it still does it so it doesn't appear to be a corrupt .ldb file. I'm not sure what to do now.

  2. #2
    Join Date
    Oct 2012
    So when its auditing the second set of data is it on the same table or another table? if its on the same one it could be just that the 1st audit is the process locking it

  3. #3
    Join Date
    Nov 2004
    out on a limb
    Provided Answers: 59
    if you are doing audit analysis then you only need write access to the table where you are depositing your results all other tables/queries should be read only.
    providing the columns are the same I'd suggest you delete all rows in each corrections table rather that drop and then recreate a table.
    then make certain you open that and write to it wwith lock optimistic rather than exclusive.
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

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