CLOSE and OPEN New SQL Connection in Access?

  • Thread starter Thread starter Al Franz
  • Start date Start date
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?
 
CurrentProject.Connection is read-only object, so you cannot close it.

Try this:

CurrentProject.OpenConnection()/CloseConnection().
 
Back
Top