Larry Haydn
Board Regular
- Joined
- Jul 18, 2019
- Messages
- 207
- Office Version
- 365
- Platform
- Windows
I develop Excel VBA application with my own SQL Server, and installs at client's premises which uses their SQL Server.
Because of this, I have to create 2 separate connection strings.
When I am using my own server, I deactivate the Client CN.
When I install at customer site, I deactivate my own CN and use the client CN.
Is there a way to switch between these two connection strings, instead of commenting them out?
Because of this, I have to create 2 separate connection strings.
When I am using my own server, I deactivate the Client CN.
When I install at customer site, I deactivate my own CN and use the client CN.
Is there a way to switch between these two connection strings, instead of commenting them out?
VBA Code:
Public Const SQLConnStr As String = "Provider=SQLOLEDB;" & _
"Data Source=[B]MyDBname[/B];" & _
"user id=[B]me\username[/B];" & _
"password=[B]MyPwd[/B];" & _
"Initial Catalog=PRODUCTION;" & _
"Integrated Security=SSPI;"
[COLOR=rgb(65, 168, 95)]'Public Const SQLConnStr As String = "Provider=SQLOLEDB;" & _
"Data Source=[B]ClientDBname[/B];" & _
"user id=[B]client\username[/B];" & _
"password=[B]ClientPwd[/B];" & _
"Initial Catalog=PRODUCTION;" & _
"Integrated Security=SSPI;"[/COLOR]