Unable to connect to SQL 2000

B

Bill Murphy

I have Developer XP Office and am attempting to use the TestConnection sub
from the Access 2002 Enterprise Developer's Handbook to programatically
create an ADO connection to my COMPAQ SQL 2000 server. User COMPAQ\bmurphy
is set up for Windows Authentication. The following code produces the error
"Login failed for user 'Bmurphy'. Reason: Not associated with a trusted SQL
Server connection." The error message displays when the Open statement is
executed.

Bmurphy is set up as a user in Windows 2000 on the same PC (which is also
named COMPAQ) with Windows password thomas. The code is:

Dim cnn As ADODB.Connection
Dim l As Long

' Create a new Connection object
Set cnn = New ADODB.Connection

With cnn

' Set the connection string and open the
' connection
.ConnectionString = _
"Provider=SQLOLEDB;SERVER=COMPAQ;UID=Bmurphy;PWD=thomas"
.Open

' List out all the connection properties
For l = 0 To .Properties.Count - 1
With .Properties.Item(l)
Debug.Print .Name, .Value
End With
Next

' Drop the connection
.Close
End With

I would appeciate any thoughts on this.

Bill
 
B

BJ Freeman

Are you using an ADP or MDB.

in the ADP you use
?CurrentProject.BaseConnectionString
in the intermediate window in the VBA editor you can
and see the structure.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top