Hello Everyone,
I have the following code:
However the information I am trying to access is on a sql serve but the workbook is on my local drive. What is the correct syntax to make the code see the sql server and the workbook that resides on my local disk drive.
TIA
Have a great day everyone!
Kurt
I have the following code:
Code:
Sub get_applications()
Dim conn As New Connection
Dim rec As New Recordset
Dim comm As New Command
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("command")
'Set ws = Worksheets("command")
conn.Open "Provider=microsoft.jet.oledb.4.0;" + _
"Data Source=CHECSQLDEV1\NEO"
'"Data Source=C:\FromDyer.mdb;"
Set comm.ActiveConnection = conn
strSQL = "USE CHEC SELECT * FROM dbo.SMT_Branches"
comm.CommandText = strSQL
rec.Open comm
ws.[a1].CopyFromRecordset rec
rec.Close: conn.Close
End Sub
However the information I am trying to access is on a sql serve but the workbook is on my local drive. What is the correct syntax to make the code see the sql server and the workbook that resides on my local disk drive.
TIA
Have a great day everyone!
Kurt