SQL SERVER ADO Connection Error (1 Viewer)

basshead22

Registered User.
Local time
Today, 08:06
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
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:06
Joined
Oct 29, 2018
Messages
13,761
Hi. Try taking out the extra quotes. For example:
Code:
ADOConn.ConnectionString = "Driver={SQL Server};Server=VLAXADGQASQL01;Database=TIMEKEEPING ;Trusted_Connection=Yes;"
 

basshead22

Registered User.
Local time
Today, 08:06
Joined
Dec 17, 2013
Messages
52
TheDBGuy thanks a mil bro!!! It worked perfect!! ugh major oversite by me !!!

Thanks!!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 08:06
Joined
Oct 29, 2018
Messages
13,761
Hi. Glad to hear it worked. Good luck with your project.
 

Users who are viewing this thread

Top Bottom