Call Single StrConn from Multiple Pages
- by Daniel
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 ""?