SQL SERVER ADO Connection Error

basshead22

Registered User.
Local time
Today, 03:24
Joined
Dec 17, 2013
Messages
52
Hi guys i'm trying to establish a connection to my back end SQL Server using ADO ...but for some reason i am encountering some errors ... I get the compile error:syntax error and it hightlight the ADOConn.ConnectionString line.... i also get Compile error: Expected: end of statement when it gets to the trusted_connection part. ... .please help not sure what else to do.

This is set up so i don't have to indicate which Active X driver to use in case the other users have a different version than the one i have i.e. 6.1 Below is my code.

---------------------------------------------------------------------------
Option Compare Database

Option Explicit
_____________________________________________________

Public Sub ADOConnection()

Dim ADOConn As Object

Set ADOConn = CreateObject("ADODB.Connection")

ADOConn.ConnectionString = "Driver={SQL Server};Server=VLAXADGQASQL01;Database=TIMEKEEPING;"Trusted_Connection=Yes;"

ADOConn.Open

End Sub
 
Hi. Try taking out the extra quotes. For example:
Code:
ADOConn.ConnectionString = "Driver={SQL Server};Server=VLAXADGQASQL01;Database=TIMEKEEPING ;Trusted_Connection=Yes;"
 
TheDBGuy thanks a mil bro!!! It worked perfect!! ugh major oversite by me !!!

Thanks!!
 
Hi. Glad to hear it worked. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom