Which line threw the error?
Which line threw the error?
It doesn't look like the maintain connection property is available when creating connection through ADODB. Since you are using conn.Open to open, I assume you are closing with conn.Close. If that is true, I think you can just delete the conn.Close. Note, though, that in general, it's a very bad idea to maintain an open connection to a database. It sucks resources on both ends and offers way more opportunity for corruption and concurrency issues. I know sometimes you just gotta do what you just gotta do, but, if there is any other alternative, like storing a local copy on a worksheet, processing as needed, then reopening connection when you're actually ready to use it. Not sure what your exact situation is, but you may want to give this some more thought.
What you say makes sense. So then, is there a way to store the user id and password while the file is open so I can create the connection when I want to perform the query and not need to ask for the password each time?
"OK, this should work......"
"#!@*"
And, again, you may find the connection manipulation much easier if you create WorkbookConnections as mentioned above.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks