title: Login failed. The login is from an untrusted domain and cannot be used with Integrated authentication Access vba
body: <p>I am trying to connect to SQL Server on the internet using VBA TCP/IP. First thing that I did was to attach tables using DSN Less connection:</p>
  <pre><code>stConnect = &quot;ODBC;DRIVER=SQL Server;SERVER=&quot; &amp; stServer &amp; &quot;;DATABASE=&quot; &amp; stDatabase &amp; &quot;;UID=&quot; &amp; stUsername &amp; &quot;;PWD=&quot; &amp; stPassword
   Set td = CurrentDb.CreateTableDef(stLocalTableName, 0, stRemoteTableName, stConnect)
  </code></pre>
  <p>This is working perfectly fine and I can now use Access linked tables to view my table contents.</p>
  <p>But when I try to create an ADODB connection:</p>
  <pre><code>  Set cn = New ADODB.Connection
    cn.ConnectionTimeout = 60
    cn.CommandTimeout = 90
    cn.Open &quot;Provider=Microsoft.Access.OLEDB.10.0;Persist Security Info=False;Data Source=&quot; &amp; stServer &amp; &quot;;Integrated Security=SSPI;Initial Catalog=&quot; &amp; stDatabase &amp; &quot;;UID=&quot; &amp; stUsername &amp; &quot;;PWD=&quot; &amp; stPassword &amp; &quot;;Data Provider=SQLOLEDB.1&quot;
  </code></pre>
  <p>With the variables parsed the above connection string looks something like this:</p>
  <pre><code>Provider=Microsoft.Access.OLEDB.10.0;Persist Security Info=False;Data Source=42.133.12.12,1433;Integrated Security=SSPI;Initial Catalog=MYDB;UID=MYDB_USER;PWD=MYDB_PASSWORD;Data Provider=SQLOLEDB.1
  </code></pre>
  <p>I get the error:</p>
  <blockquote>
  <p>Login failed. The login is from an untrusted domain and cannot be used
  with Integrated authentication.</p>
  </blockquote>
  <p>I have looked at various places online but have not found any solutions.</p>