Originally Posted by LaVolpe
The more simple way is to not return the entire table, but use a query to return the filtered results. If the query returns no records, alert user. If it does return records, you would use basically the same loop to add the records to your listivew; you just won't have to validate the date field because the query already did that.
Now you may ask, so what's the difference? The difference is immense when you are talking about databases that contain hundreds, thousands records. Let's say only 5 match the date. Your method would require touching each record to find those 5, the query method only touches those 5.
Now regarding alerting the user in your current code. Simply check the ListView listitem count at the end. If it is zero, no records found & popup a msgbox as needed.