devxlogo

Avoid Update Errors In Access Databases

Avoid Update Errors In Access Databases

Avoid “Couldn’t update; currently locked by user ‘name’ onmachine ‘machine’ ” error in VB4 when two or more applicationsaccess the same MS Access database table.

For the given table, a primary or any nonunique key is defined.The two applications may have opened the database table as anyone of the record-set types such as dynaset or table.

If one of the applications is idle (just opened the record setand no edit/updation taking place) and the other application triesto update or add a record to the table, then the Error Code: 3260(“Couldn’t update; currently locked by user ‘name’ on machine’machine’ “) is displayed.

To avoid this, after the record set is opened (in case of a tablerecord set, if index is being set, then after the Index propertyis set), include this statement:

 DBEngine.Idle (dbFreeLocks)

VB4 releases the table locks and now the other application willbe able to update the database table. For example:

 Dim DB as Database, TB as RecordsetSet Db = WorkSpaces(0).OpenDatabase_        ("Test.mdb")Set TB = Db.OpenRecordset("Customer_        Master",dbOpenTable)Tb.Index = "PrimaryKey"DBEngine.Idle (dbFreelocks)
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist