File already in use. Not really! (1 Viewer)

reburton

Registered User.
Local time
Today, 03:51
Joined
Nov 4, 2013
Messages
46
Hi,
I have a problem with making an ADO connection. Access raises an error saying that my file is already in use. It is not. What could cause that?
Here is a screen shot of the error with the code in the background. It is choking on the line:
cnADO.Open strConnection
The screenshot:
FileInuse.jpg
Help!?!?
 
Last edited:

spikepl

Eledittingent Beliped
Local time
Today, 12:51
Joined
Nov 3, 2010
Messages
6,142
WHat is the full path of the file from which you execute the code?
 

reburton

Registered User.
Local time
Today, 03:51
Joined
Nov 4, 2013
Messages
46
C:\Users\OBBurton\Documents\ADOExamples.accdb
 

spikepl

Eledittingent Beliped
Local time
Today, 12:51
Joined
Nov 3, 2010
Messages
6,142
So you are linking the file to itself, so how do you arrive at "Not really?") :)
 

reburton

Registered User.
Local time
Today, 03:51
Joined
Nov 4, 2013
Messages
46
Thanks,
I mean that the error message implies someone or something else has it open. Why would it throw an error about having the file open?
 

spikepl

Eledittingent Beliped
Local time
Today, 12:51
Joined
Nov 3, 2010
Messages
6,142
There are multiple ways of opening an ado connection, esepcially to current db. I don't use ADO so I don't know how to in your case. Google would yield an answer in 2 minutes.

If you do not have any specifics requiring ADO then drop it and use DAO. Rather simpler, IMHO.
 

boblarson

Smeghead
Local time
Today, 03:51
Joined
Jan 12, 2001
Messages
32,059
I think it is what you are using for the connection. If you are connecting to the database where your code is located, the code should be:

Set cnADO = CurrentProject.Connection
 

reburton

Registered User.
Local time
Today, 03:51
Joined
Nov 4, 2013
Messages
46
Thanks again! To spikepl, I am learning over and over again (it takes a lot of repetition for us knuckleheads) about the power of Google. I'm sure part of the problem is my underlying hatred for the company. Just the company, mind you not the search engine, I won't use any other. :eek:
 

Users who are viewing this thread

Top Bottom