When I open my access database that has linked tables (via ODBC connection under System DSN) to SQL Server, I automatically have a form open at Startup. This form contains data from the linked SQL table. So when then form opens, I get a login prompt to enter my user name and password. Which I have to enter each time I open my access database (one time only during each opening). So I created a VBA function that I use in my "AutoExec" macro to attempt to pass this login info. The macro does not fault out when I open the access database, but I am still prompted to enter the login credentials that I would like to pass using VBA. How can I automatically send the login credentials? Thanks.
Public Function Autoconnect()
Dim cnn1 As Object
Dim strCnn1 As String
strCnn1 = "Provider=SQLOLEDB;Data Source=xxx.x.x.xx;Initial Catalog=QA;User ID=test;Password=;"
Set cnn1 = CreateObject("ADODB.Connection")
cnn1.ConnectionString = strCnn1