Error SQL server does not exist or no login permissions error when running VBA function

I am running this function from WIN7  using Access 2010 to an MSWIN 2008 R2 server hosting MSSQL 2008 R2 and receive the above message. I can connect using SQLCMD using my user ID and server name with no problem.  


Dim CompassConnection As Variant
    Set CompassConnection = CreateObject("ADODB.CONNECTION")
    CompassConnection.ConnectionString = "ODBC;Description=Compass;DRIVER=SQL Server;SERVER=OTTCOMPASS\ITNETCOMP1;APP=Microsoft Open Database Connectivity;WSID=OTTWS100;DATABASE=Compass;Trusted_Connection=Yes;"
        If CompassConnection.Open Then
       MsgBox "The connection has been established."
    End If

    Set CompassConnection = Nothing


Does anyone have any ideas ?

Thanks for any help you can provide.
Who is Participating?

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

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.

Scott McDaniel (Microsoft Access MVP - EE MVE )Infotrakker SoftwareCommented:
I can connect using SQLCMD using my user ID and server name with no problem.  
The connection string you show is using a Trusted Connection, so perhaps your server is configured to use SQL Authentication only. Try modifying your connection string like this:

 CompassConnection.ConnectionString = "ODBC;Description=Compass;DRIVER=SQL Server;SERVER=OTTCOMPASS\ITNETCOMP1;APP=Microsoft Open Database Connectivity;WSID=OTTWS100;DATABASE=Compass;UID=YourUserID;PWD=YourPassword;"

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
Martin LissOlder than dirtCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
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 SQL Server 2008

From novice to tech pro — start learning today.