Connecting to an SQL Server Using a DSN-less Connection
Sub Connect_ToSQLServer()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
With conn
' DSN-less connection using the ODBC driver
' (modify the data source information below)
.Open "Driver={SQL Server};" & _
"Server=192.168.1.100;" & _
"UID=myId;" & _
"PWD=myPassword;" & _
"Database=SupportDb"
.Close
End With
Set conn = Nothing
End Sub