I've had the following code that's been working for several years.
	
	
	
		
I'm not sure since when, but recently this fails to open a connection to server.
There's no trouble in adding linked tables from sql server to my database.
		
		
	
	
		
	
		
	
I'm not sure, but there's a good chance it's happening since installing ODBC Driver 18.
Any kind of help is much appreciated.
 
		Code:
	
	
	Option Explicit
Private Const Server = "Server"
Private cn As New ADODB.Connection
Private rs As New ADODB.Recordset
Public Function ConnectToDB_ADO()
    Dim Con As String
    On Error Resume Next
   
    If cn.State = 1 Then Exit Function
    Con = "Driver={SQL Server};Server=" & Server & ";Database=Receiption;Trusted_Connection=yes;"
    cn.Open Con
    Debug.Print cn.State
    Do While cn.State <> adStateOpen
        DoEvents
        If cn.State = adStateClosed Then Exit Function
    Loop
   
End Function
	I'm not sure since when, but recently this fails to open a connection to server.
There's no trouble in adding linked tables from sql server to my database.
I'm not sure, but there's a good chance it's happening since installing ODBC Driver 18.
Any kind of help is much appreciated.
			
				Last edited: