Excel VBA ADO Query to Oracle not filtering on date

In an Excel VBA procedure, I am retrieving data from an Oracle table and writing it to a worksheet. The procedure works fine, except for one oddity. I can filter the data on anything but a date column. I checked - this column is a DATE in the Oracle table, but the recordset result completely ignores any attempt to filter on it. No error, it just ignores it.

So, for example, if I run any of these three queries in an Oracle-connected UI (I use PL/SQL Developer), i get the exact same records:

select *
from myTable
where myDate >= '07SEP2018'
order by myDate desc

select *
from myTable
where myDate >= '07-Sep-2018'
order by myDate desc

select *
from myTable
where myDate >= to_date('07-SEP-18')
order by myDate desc
   
The results are filtered by the date 9/7/2018.

However, when I run the same query in ADO to fill a recordset using any of these formulations, I simply get the whole table - all dates, going back to 2016. Here is my code:

strSQL = "select * " & _
    "from myTable " & _
    "where myDate >= to_date('07-SEP-18') " & _
    "order by myDate desc"
   
    'create, configure, and populate recordset
    Set rs = New ADODB.Recordset
    rs.CursorType = adOpenForwardOnly
    rs.Open (strSQL), cn

I have tried all 3 of the above variations in ADO also, with the same result. I am using the ADO 6.1 library and Oracle 11g.

Any idea what the issue is?

Thanks.
bassman592Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

awking00Information Technology SpecialistCommented:
where myDate >= to_date('07-SEP-18')  should be where myDate >= to_date('07-SEP-18','DD-MON-RR')
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bassman592Author Commented:
Perfect - thank you!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ADO

From novice to tech pro — start learning today.