title: Connection to server failed from VBA but works from Access
body: <p>I have setup some queries in MS access that fetch data from a MS SQL server on the network. The queries work fine when I run them from MS access. However, when trigger the same query through VBA in Excel (need of my dashboard), then it says ODBC connection failed. I am not able to figure out what is broken in the process. All details below:</p>
  
  <p>ODBC connection string in MS Access - set in the properties of the query</p>
  
  <pre><code>ODBC;DRIVER=SQL Server;SERVER=xyz;UID=xyz_reader;PWD=xyzpassword;Network=DBMSSOCN;Address=xyz,1433
  </code></pre>
  
  <p>Connection string used in Excel VBA - this is used to trigger the odbc query in ms access</p>
  
  <pre><code>strConnection = "Provider=Microsoft.ACE.OLEDB.12.0;" &amp; "Data Source=" &amp; mydb.accdb
  </code></pre>
  
  <p>Error that I get</p>
  
  <pre><code>Run-time error '-2147467259 (80004005)':
  ODBC--connection to 'SQL Serverxyz' failed.
  </code></pre>