Checking for Errors when Opening Recordsets

As with opening databases exclusively, setting locks on recordsets can cause errors if the lock fails. Using the four-step process described earlier, you can handle recordset locking problems with a generic procedure that takes into account the most common multiuser errors.

The most common error in locking recordsets occurs when another user has the recordset open in a way that prevents you from obtaining the lock you want. This is identified as error 3262. The following table explains this error.

Error number and text Cause and suggested response
3262 Couldn’t lock table <tablename>; currently in use by user <username> on machine <machinename>. Occurs when you attempt to use the OpenRecordset method to open an object that cannot be locked. This is usually caused by another user who has the same table or tables locked in a way that prevents your lock.

Wait a short interval and retry the operation.