I'm using the DOA.Recordset method to open a recordset based on a SQL statement. (SELECT * FROM ....)
I then use 'If Not (rst.EOF and rst.BOF) then' ... to check if the recordset is populated.
This normally works fine except when I use some sort of Group by, Max etc. in the SQL statement. In this case, even when there are no records, the .EOF and .BOF read false. I even get a record count of 1.
Am I doing something wrong in the way that I am generating the recordset?
An example of my SQL would be as follows:
Any help would be much appreciated!
I then use 'If Not (rst.EOF and rst.BOF) then' ... to check if the recordset is populated.
This normally works fine except when I use some sort of Group by, Max etc. in the SQL statement. In this case, even when there are no records, the .EOF and .BOF read false. I even get a record count of 1.
Am I doing something wrong in the way that I am generating the recordset?
An example of my SQL would be as follows:
Code:
strSQL = "SELECT Max(Tbl_ScanResults.EndTimeStamp) AS EndTimeStamp " & _
"FROM Tbl_ScanResults WHERE (((Tbl_ScanResults.ScannerID)='" & MyScanID(i) & "') AND " & _
"((DateValue([EndTimeStamp]))=DateValue(Now())));"
Any help would be much appreciated!
Last edited: