Hello all,

I wonder if any of you know how to get around this problem. I create a
Connection String to a certain directory, then execute a query to extract
some data from a DBF. After doing that, I can no longer rename that
directory; it appears to be locked.

The code is below.

Set oConnDBF = New ADODB.Connection
oConnDBF.Open "Driver={Microsoft dBASE Driver (
*.dbf)};DriverID=277;Exclusive=No;Dbq=C:\RM;"
Set rs = oConnDBF.Execute("select COL3 from table")
sys$ = rs.Fields(0)
rs.Close
Set rs = Nothing
oConnDBF.Close
Set oConnDBF = Nothing

To test where the problem is, I single-step each line in VB, then try to
rename the C:\RM dir in a DOS window. I can rename C:\RM until I execute the "Set rs = oConnDBF.Execute" line. After executing that, DOS tells me "The process cannot access the file because it is being used by another process." Which is what I expect.

But after executing the next 4 lines (closing and setting the objects to
nothing), I still get the same DOS error. I would have thought that
closing and setting to nothing would have released any handles open to the C:\RM directory. What have I overlooked?

And even stopping the VB program doesn't allow the C:\RM dir to be
renamed. It is only after I exit VB that I can rename the directory.

Any ideas would be welcome.

-Steve