A2000 ADO Connection String Error

G

Guest

Hello everyone,
I am trying to get a connection string to work and I have tried a variety
of things but to no avail. I have used the same connection string in an
A2003 and it works fine. The code is below:

Dim OConn As ADODB.Connection
Dim strConn As String

On Error Resume Next
Set OConn = New ADODB.Connection
OConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\Documents and Settings\Owner\My
Documents\DTS\WP&L\JobTrackingBESec.mdb;" & _
"Jet OLEDB:System Database=C:\Documents and Settings\Owner\My
Documents\DTS\WP&L\WPLsystem.mdw, User Id=Patrick;Password=4554"

Set OpenConn = OConn

I receive a runtime error 3709 "This connections cannot be used to perform
this operation. It is either closed or invalid in this context."

The path statements have been triple checked, the database and system.mdw
files are correct. Does anyone know what I'm doing wrong? Are there
differences in syntax or otherwise in Access 2000? Thanks so much.
Debbie
 
B

Brendan Reynolds

It's difficult to be certain, but I suspect that the error may lie elsewhere
in the code, and not in the code that you posted here. How and where is
'OpenConn' declared? Which line of code raises the error? It might help to
remove, or at least comment out during testing, the 'On Error Resume Next'
statement.
 
G

Guest

Brendan,
Thank you for your reply. You were right, when I removed the On Error
statement I did get a different error. The error is:

Cannot start your application. The workgroup file is either missing or
opened exclusively by another user.

I checked the path again, it is correct. The error occurs on the OConn.Open
statement. I have used this exact statement is A2003 without any problems.
Could there be something wrong with the workgroup file? That is new but the
security works fine until I programmatically connect to the backend. Thanks,
Debbie
 
B

Brendan Reynolds

One possibility is a permissions issue on the folder containing the
workgroup file. You'll need read, write and delete permissions on that
folder so that JET can successfully create the LDB file and delete it when
it is no longer in use.
 
G

Guest

Brendan,
Thanks for your reply. I'm thinking it's something else because I have this
installed on my own PC which doesn't have any security on the drive. I will
keep plugging along, thanks for all your help.
Debbie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top