Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error number 3050

Status
Not open for further replies.

kenguru

Programmer
Joined
May 14, 2004
Messages
173
Location
RO
Hi,

I go the following error message in my visual basic proiect: Error 3050 - Couldn't lock file. In my program I am using a database connection.
Does anyone know what could be the problem? After I gave a restarat to the computer it is functionating well. But it is strange this to me:).
Please write to me.
Many thanks,
Kenguru
 
It usually means one of three things:

1. You don't have write permission in the folder to write the .LDB (lock file)

2. Another user already has the file open exclusively.

3. You didn't properly close the file one your last use. This sounds most likely if a re-boot clears it. Check that you close all connections and set them to Nothing when you've finished with them

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Hi,
In my program I set at the end of the connection the recordset=Nothing, Database=nothing. This program is used on more than one computer. Is it possible if someone else uses the program, and accesses my database, than other user can't access it? If so, it is impossible to access the database for two differents users?
Kenguru
 
Make sure that you only open the recordset for the required type of access, open it only when you need it and close the recordset as soon as you've done with it.

Look up cursor types:
VBHelp said:
Use an ADO Recordset object with a client-side, Static cursor that specifies read-only locking (CursorLocation = adUseClient, CursorType = adOpenStatic, and LockType = adLockReadOnly) if you don't need to update the server tables. For forms, you can achieve the same result by setting the form's RecordsetType property to Snapshot. If you do need to update server tables, use an ADO client-side cursor (CursorLocation = adUseClient) with a Static cursor (CursorType = adOpenStatic) and use batch optimistic locking (LockType = adLockBatchOptimistic) so that you can perform batch updates by using the BatchUpdate method. For forms, you can achieve a similar result by setting the form's RecordsetType property to Updatable Snapshot.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top