I am trying to figure out why my SQL is returning EOF = False and throwing an error when there is no value in the table that has a woodcat = Logs and Diameter >= 24
In other words this query, based on the current table I have, should return EOF = True and I do not know why it does not.
The code below throws the following error:
Runtime Error. Invalid use of Null
Dim db as database
Dim strVol as string
Dim recVol as Recordset
Dim logs24 as Double
Set db = CurrentDb()
strVol = "SELECT Sum(VOLHA) AS TOTVOL FROM tblMTally WHERE woodcat = 'Logs' AND ta_dbh >= 24;"
Set recVol = db.OpenRecordset(strVol, dbOpenDynaset)
If .EOF = False Then
logs24 = Nz(CDbl(!TOTVOL), 0) 'error thrown on this line