No issues , thanks .
No issues , thanks .
Not the smartest query but this will work in case anyone has the same problem
Any improvements/suggestions are most welcome.![]()
Sub Button1_Click() Dim cnn As ADODB.Connection Set cnn = New ADODB.Connection Dim Cmd1 As New ADODB.Command Dim ReturnArray As DAO.Recordset Dim mrs As New ADODB.Recordset Dim rsTest As ADODB.Recordset Dim DBPath As String, sconnect As String ' Open a connection using an ODBC DSN "Pubs". cnn.ConnectionString = "DSN=XXX;UID=XXX@xxx.com;PWD=xxxx;" cnn.Open ' Find out if the attempt to connect worked. If cnn.State = adStateOpen Then MsgBox "Echo!" Else MsgBox "Sorry." End If Cmd1.ActiveConnection = cnn Cmd1.CommandText = "sql query" mrs.Open Cmd1 If Not mrs.EOF Then Sheets("Sheet2").Range("A1").CopyFromRecordset mrs End If mrs.Close ' Close the connection. cnn.Close End Sub
Thanks,
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks