This succeeds. I have an ON Error GoTo above it, and that is not triggered. The connection string is built from defining a connection over the Menus Data / Connections and copy/pasting the useful bits.
' Instantiate the ADO-objects. Set connSQLS = New ADODB.Connection Set rsSQLS = New ADODB.Recordset Debug.Print "Access connection var and recordset var defined" ' Path to the database. sDBServer = "MyServer" sDBName = "MyDBTest" ' Create the connection string sConnectionStringSQLS = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=" & sDBServer & ";" & _ "InitialCatalog=" & sDBName & ";" 'Open the connection connSQLS.Open (sConnectionStringSQLS)
The error is: Invalid object name 'MyTable'
' Check connection rsSQLS.Open "SELECT Max(ID) FROM MyTable", connSQLS
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.