CLOSE and OPEN New SQL Connection in Access?

A

Al Franz

Using File>Connection in Access one can connect to database of
choice. My Access application needs to be able to switch SQL
database connections from within the application, without having
to do it in Design Mode.

Have tried the following commands...

CurrentProject.Connection.Close
CurrentProject.Connection.Open (strConn)

But get the error "Operation is not allowed when the object is open".

Has anyone done this successfully?
 
N

Norman Yuan

CurrentProject.Connection is read-only object, so you cannot close it.

Try this:

CurrentProject.OpenConnection()/CloseConnection().
 

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