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:
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)