Access and Oledb Connection .net

J

JJ

Hi,

I am connecting to an access db using an oledb provider. The file is
located on another server. I noticed that after I done accessing the database
the file still remains locked after I close my app. what can I do to make
sure this is doesn't happen?

Thanks,
JJ
 
A

Arvin Meyer [MVP]

Try explicitly closing the connection.


Sub ADOOpenDB()
Dim cnn As ADODB.Connection

Set cnn = New ADODB.Connection
cnn.Open "Provider=Micrtosoft.Jet.OLEDB.4.0;" & ' ... Whatever

cnn.Close
Set cnn = Nothing

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
J

JJ

Yes I do close connection and app but there is still a lock file showing up
in same directory as db.

JJ
 
A

Arvin Meyer [MVP]

All recordsets must be closed explicitly. Additionally, if you are using an
MDB, make sure that any reference to a boolean control is explicit:

Not:

If Me.chkWhatever Then

But:

If Me.chkWhatever = True Then
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
B

Brendan Reynolds

Does the identity under which your application runs have delete permission
on the folder where the LDB is created?
 
Top