Link to home
Start Free TrialLog in
Avatar of Davidloc
DavidlocFlag for Canada

asked on

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.  

Function

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
   
    CompassConnection.Close

    Set CompassConnection = Nothing

END FUNCTION


Does anyone have any ideas ?

Thanks for any help you can provide.
ASKER CERTIFIED SOLUTION
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.