title: MS Access - SQL Server Login Prompt won't go away
body: <p>So I have this application and I moved all local tables to SQL Server using upsizing, now they are currently linked tables. I'm able to access tables and forms related to tables can be accessed with no problems. But when I programmatically fetch a record, or perform a sql operation in VBA script, a SQL Server Login prompt pops up asking me to enter in the SQL Authentication login to access the database.</p>
  
  <p>I followed this link here:</p>
  
  <p><a href="https://support.microsoft.com/en-us/kb/177594" rel="nofollow">https://support.microsoft.com/en-us/kb/177594</a></p>
  
  <p>Where this is my end code:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim db1 As Database
  Dim db2 As Database
  Dim rs As Recordset
  Dim strConnect As String
  Set db1 = OpenDatabase("C:\Workspace\ms1.mdb")
  
  
  strConnect = UCase(db1.TableDefs("dbo_TableA").Connect) &amp; ";UID=User1;PWD=Password1"
  
  Set db2 = OpenDatabase("", False, False, strConnect)
  db2.Close
  Set db2 = Nothing
  Set rs = db1.OpenRecordset("dbo_TableA")
  rs.Close
  db1.Close
  Set rs = Nothing
  Set db1 = Nothing
  
  
  DoCmd.RunCommand acCmdSaveRecord
  
  'Sql Server login prompt pops up after running the below code;'
  If DCount("*", "TableA", "[ColA] = [forms]![FRM_LOGS]![USER]") = 0 Then
      MsgBox "User ID not found - contact HelpDesk", vbCritical
      DoCmd.Quit
      Exit Sub
  End If
  </code></pre>
  
  <p>The DCount is triggering the SQL Server Login Prompt. I need this prompt to go away. If I open up a form, query, report, anything where the access object is bound to the data, I get no message. It ONLY happens in VBA when I'm trying to access the data object.</p>
  
  <p>Edit! I did find the culprit. I deleted the linked table to the TableA in sql server, and I relinked it again, and clicked the Save password checkbox. I did this before, and it didn't work. Did it again, and it fixed everything. Not sure why this didn't work the first time. I marked the below as an answer because that did solve the problem given the circumstances.</p>