PDA

View Full Version : Connection String in Excel VBA



joprotus
08-01-2007, 03:55 AM
I am currently developing a VBA program that automatically connects the pivot table to an MS Access database. My problem is how can I make my program flexible to handle different databases like SQL Server or Oracle. Is it possible to generate a different connection string at run time?:banghead:

Any help will be appreciated.:help

Bob Phillips
08-01-2007, 04:05 AM
Of course it is.

Create separate sub-routines with the different connection strings setup, and call the appropriate one at runtime.

You will have to determine how that decision is made.

joprotus
08-04-2007, 08:17 PM
Thanks xld, but is it possible to make more flexible like a connection builder.

Bob Phillips
08-05-2007, 05:51 AM
You would need to elaborate what you mean by that.

anandbohra
08-06-2007, 05:30 AM
hope this will help u to quickly recall the connection string code


http://www.connectionstrings.com/

joprotus
09-05-2007, 12:24 AM
Thank you guys for the help. I am sorry if I didn't make myself clear here. Fortunately, I solved this problem already. Here's the link of the solution: Building Database Connection String Programmatically (http://msexcelvba.blogspot.com/2007/08/building-database-connection-string.html)