Having a bit of trouble with an Excel SQL Query where clause.
The data in my sheet within excel (as far as I can see) is empty, there are no values and no formatting etc. in the cell. I am trying to run the following query from Outlook (in VBA).
strQuery = "Select Count(ReviewDate) as UnassignedCount FROM [PatComDB$]
Where ReviewDate is null "
But the query is returning 0.
I have searched for some solutions and have tried the below.
strQuery = "Select Count(ReviewDate) as UnassignedCount FROM [PatComDB$]
Where IIF(ReviewDate is null,0,ReviewDate) "
(Which returns 7 - the count of the field that is not null)
And have had no luck.
My connection clause is as follows (if it is any use)
Set Con = New ADODB.Connection
With Con
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=<some link>;" & _
"Extended Properties=Excel 8.0;"
.Open
End With
and my sheet looks something like this
IdeaID RPA Type SubDate ReviewDate
IdeaID1 RPA1234 Existing 01/01/2015
IdeaID2 RPA1235 New 02/01/2015
IdeaID3 RPA1236 Existing 03/01/2015
IdeaID4 RPA0001 New 04/01/2015 01/09/2015
IdeaID5 RPA0001 New 05/01/2015 02/09/2015
IdeaID6 RPA0001 New 06/01/2015 07/09/2015
IdeaID7 RPA0001 New 07/01/2015 07/09/2015
IdeaID8 RPA0001 New 08/01/2015 07/09/2015
IdeaID9 RPA0001 New 09/01/2015 07/09/2015
IdeaID10 RPA0001 New 10/01/2015 07/09/2015
Does anyone have any ideas where I could be going wrong, be it my query or the data in my sheet perhaps?
Note: I am unfortunately restricted to Outlook and Excel in terms of software.
Thanks in advance.
EDIT:
Forgot to mention that running the following query on the same data set returns NULL
strQuery = "Select * FROM [PatComDB$] Where Index = 1"
rsARR = rs.GetRows
Debug.Print (rsARR(6, 0))