Info Did

1 open the connection.

Set cnn = New ADODB.Connection

With cnn

.Provider = "Microsoft.Jet.OLEDB.4.0" .Open MyConn End With

Set rst = New ADODB.Recordset rst.CursorLocation = adUseServer

1 open the first query rst.Open Source:=sSQL, _

ActiveConnection:=cnn, _ CursorType:=AdForwardOnly, _ LockType:=adLockOptimistic, _ Options:=adCmdText

Range("A1:C1").Value = Array("Store", "Qty", "Date")

1 Return Query Results

Range("A2").CopyFromRecordset rst rst.Close cnn.Close

End Sub

0 0

Post a comment