Establish ODBC connection using access VB

I am using the attached code to establish an ODBC connection in the ODBC Data source administrator.  This enables me to then establish a link to the tables within the SQL server using VBA.  The issue I have is I must change the:
change the default database to:
to being unchecked or make the value in the combo box to be the value for this given database.
I do not have access to the registry to look and see how the atribute must be established to turn this value off.

So the question is what do I have to add to the strAttributes code to remove the
Sub RegisterDatabaseX()
 
   Dim dbsRegister As Database
   Dim strAttributes As String
   Dim errLoop As Error
 
   ' Build keywords string.
   strAttributes = "Database=Temp" & _
      vbCr & "Description=Temp Database" & _
      vbCr & "OemToAnsi=No" & _
      vbCr & "Server=ngsdb.spr.navistar.com" & _
      vbCr & "Trusted_Connection=Yes" & _
      vbCr & "QuotedId=No" & _
      vbCr & "QuotedId=No" & _
      vbCr & "AnsiNPW=No"
      
   ' Update Windows Registry.
   On Error GoTo Err_Register
   DBEngine.RegisterDatabase "Temp", "SQL Server", True, strAttributes
   On Error GoTo 0
   Exit Sub
 
Err_Register:
 
   ' Notify user of any errors that result from
   ' the invalid data.
   If DBEngine.Errors.Count > 0 Then
      For Each errLoop In DBEngine.Errors
         MsgBox "Error number: " & errLoop.Number & _
            vbCr & errLoop.Description
      Next errLoop
   End If
   Resume Next
End Sub

Open in new window

DSN-Config-Screen-Shot.JPG
LVL 8
Joe OvermanEngineerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jim P.Commented:
Add in a database line:
  strAttributes = "Database=Temp" & _
      vbCr & "Description=Temp Database" & _
      vbCr & "OemToAnsi=No" & _
      vbCr & "Server=ngsdb.spr.navistar.com" & _
      vbCr & "Database=Temp" & _
      vbCr & "Trusted_Connection=Yes" & _
      vbCr & "QuotedId=No" & _
      vbCr & "QuotedId=No" & _
      vbCr & "AnsiNPW=No"

Open in new window

0
Jim P.Commented:
I read it backwards:
 strAttributes =  "Description=Temp Database" & _
      vbCr & "OemToAnsi=No" & _
      vbCr & "Server=ngsdb.spr.navistar.com" & _
      vbCr & "Trusted_Connection=Yes" & _
      vbCr & "QuotedId=No" & _
      vbCr & "QuotedId=No" & _
      vbCr & "AnsiNPW=No"

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Joe OvermanEngineerAuthor Commented:
That is just what I needed.  Thanks.  I am not sure why I could not figure that our myself.  Again thanks.
0
Jim P.Commented:
Glad to be of assistance. May all your days get brighter and brighter.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.