Call Single StrConn from Multiple Pages
Posted
by Daniel
on Stack Overflow
See other posts from Stack Overflow
or by Daniel
Published on 2010-06-17T19:08:23Z
Indexed on
2010/06/17
19:13 UTC
Read the original article
Hit count: 183
I have a ocnnection to SQL Server set up in my vba code.
The format is:
strConn = "ODBC;Driver=SQL;Server=SQL1;Database=DB1;Uid=1;Pwd=1"
I have this in 4 sheets, but there will be times when I will want to change it to call from SQL2 or SQL3, and instead of changing the code on each sheet 4 times, I want to change it only once.
Is there a way to set up that line to run by calling it from somewhere else or by passing in a string into the ""?
© Stack Overflow or respective owner