Question

I have VBA excel code that runs a SQL query in Teradata and spits the results back out into Excel. Instead of the following (which I have in my code), I would like to have an "input box" pop up for the user to input their user ID and password, instead of having it sitting in the code itself, for security reasons. Any ideas/Is this possible? I have worked with message boxes and inputs before, but am stumped on how to do it for this instance. Thanks!

 connect.Open "Data Source=****; Database=****; Persist Security Info=True; User ID=****; Password=****; Session Mode=ANSI;"
Was it helpful?

Solution

strUser = InputBox("User ID")
strPwd = InputBox("Password") 
connect.Open "Data Source=****; Database=****; Persist Security Info=True; User ID=" & strUser & "; Password=" & strPwd & "; Session Mode=ANSI;"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top