Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trusted connection to SQL server

Status
Not open for further replies.

workhouse

Technical User
Feb 3, 2004
2
US
I want my MSAccess 2000 (mdb)application to use a trusted connection to the database residing on my SQL server 2000.
1. SQL Server security is set to "SQL server and Windows"
2. I'm listed as a USER for my database with "select" permissions to several tables.
3. I'm logged into the PC I'm using.
4. The connection works if I replace
"Trusted_Connection = True" with
"User Id= myloginname ; Password=mypassward;"

5. My open connection code in my MSAccess application module1 is :

Option Compare Database
Option Explicit
Public ConnMyDatabase As New ADODB.Connection
-----------------------------------------
Public Sub OpenConnMyDatabase()
On Error GoTo Err_OpenConnMyDatabase
'Set up first connection for OLEDB for MyDatabase
Set ConnMyDatabase = New ADODB.Connection
ConnMyDatabase.ConnectionString = "Provider = sqloledb;" & _
"Data Source=MyServerName;" & _
"Initial Catalog=MyDatabaseName;" & _
"Trusted_Connection = True"
ConnMyDatabase.ConnectionTimeout = 30
ConnMyDatabase.Open
Exit Sub

Err_OpenConnMyDatabase:
MsgBox prompt:="error" & Error

End Sub
-----------------------------------------


One last thought, my the network account has the same login name as my SQL server login name but the passwords are different. Trusted login works with an ADP but not with the MDB. ???

I found http:\\ and a few other resources but I still don't see the solution.

Anyone know what I'm doing wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top