using oledb to retrieve data from sql server w A2K
Using Access 2000 and trying to retrieve data from SQL Server using dsn-less connection. This is what I have but it does not work. Thanks for any help.
Sub subtest()
Dim strsql As String
Dim cmd As New ADODB.Command
strsql = "SELECT C1.* INTO Customers FROM [Provider=sqloledb;Data Source='server1';Initial Catalog='db1';Integrated Security=SSPI].customers AS C1;"
With cmd
.ActiveConnection = CurrentProject.Connection
.CommandText = strsql
.CommandType = adCmdText
.Execute
End With
cmd.Close
Set cmd = Nothing
Debug.Print "done"
|