Prompt for username and password using sqloledb

Connection string

This Microsoft OLE DB Provider for SQL Server connection string can be used for connections to SQL Server 2000 and SQL Server 7.0.

This one is a bit tricky. First set the connection object's Provider property to "sqloledb". Thereafter set the connection object's Prompt property to adPromptAlways. Then use the connection string to connect to the database.

oConn.Provider = "sqloledb"
oConn.Properties("Prompt") = adPromptAlways

oConn.Open "Data Source=myServerAddress;Initial Catalog=myDataBase;"