If any of the Connection parameters to the SQL Server is wrong then I get prompted to enter the SQL server password.
Is there a way to check for the presence of the SQL Server without the user being prompted for the password.
I use a DSNless connection from A365 to SQL Server Express and the following code creates linked tables for all the tables stored in tblTableList
Is there a way to check for the presence of the SQL Server without the user being prompted for the password.
I use a DSNless connection from A365 to SQL Server Express and the following code creates linked tables for all the tables stored in tblTableList
Code:
'Go through all tables in tblTableList
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
rst.Open "tblTableList", CurrentProject.Connection, adOpenKeyset, adLockPessimistic
If rst.BOF And rst.EOF Then
Else
rst.MoveFirst
Do While Not (rst.EOF)
'Need Server name, Username, Password
stConnect = "ODBC;DRIVER=ODBC Driver 17 for SQL Server;SERVER=" & strServerWithPathname & ";UID=" & strUsername & ";Trusted_Connection=No;" _
& "APP=Microsoft Office;DATABASE=VF3;PWD=" & strPassword & ";TABLE=" & rst!strFETable & ""
Set tdf = CurrentDb.CreateTableDef(rst!strFETable, dbAttachSavePWD, rst!strBETable, stConnect)
CurrentDb.TableDefs.Append tdf
rst.MoveNext
Loop
End If