I'm trying to pull data into Excel from a SQL database with date parameters. The following VB query works. Instead of manually changing the date values in the TS of the VB query, I want to have the query use cell values from the spreadsheet. Cell A1 has the date for the >= TS, and cell A2 has the date for the < TS
Sub vba_query_01()
    Dim oCon As ADODB.Connection
    Dim oRS As ADODB.Recordset
    Set oCon = New ADODB.Connection
    oCon.ConnectionString = "DRIVER=SQL Server;SERVER=GSEYBERTHNB7
         \SQLEXPRESS;UID=gseyberth;Trusted_Connection=Yes;APP=2007 Microsoft Office 
         system;WSID=GSEYBERTHNB7;DATABASE=DATA_LOGGER"
    oCon.Open
    Set oRS = New ADODB.Recordset
    oRS.ActiveConnection = oCon
    oRS.Source = "Select * FROM DATA_LOGGER.dbo.LYLE LYLE WHERE (( [Date] >= {TS '2013-04-24 
        07:00:00'} )) AND (( [Date] < {TS '2013-04-24 15:00:00'} ))"
    oRS.Open
    Range("A10").CopyFromRecordset oRS
    oRS.Close
    oCon.Close
    If Not oRS Is Nothing Then Set oRS = Nothing
    If Not oCon Is Nothing Then Set oCon = Nothing
End Sub
