VB Code:
Public conSQL As ADODB.Connection
Public rs As ADODB.Recordset
Set conSQL = New ADODB.Connection
With conSQL
.ConnectionTimeout = 30
.Provider = strProvider ' strProvider=SQLOLEDB.1
.CursorLocation = adUseClient
.ConnectionString = "Server=" & strServer & ";" & "User Id=" _
& strUserId & ";" & "Password=" _
& pwd & ";" & "Initial Catalog=" & strInitCat ' strServer= yourServer Initial Catalog=yourDatabase
.Open
'.Execute "Set Dateformat 'dmy'" ' used in Norway to force date format
End With