I have data with a date that I want to exclude from my current data. I am trying to pull the required date from a sql table and compare it to the dates in the excel sheet.
The sql code is
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
DIM code_string as STRING
code_string = "select date from table WHERE foo foo foo"
and the result is a date that I want to save in a variable.
I have tried Set rst = CurrentDb.OpenRecordset(strSQL)
that I found here: How to save the result of a SQL query into a variable in VBA?
and vba gives me an object required error.
Is there a way to save the results of a sql query in a vba variable?