-
Dao
I've created a custom function in VBA that looks up a value in some table using DAO code.
My problem is, I need to test whether the DAO recordset contains something, and that is by doing .MoveLast and .MoveFirst. I can't test for emptiness of the recordset unless I execute these methods. But when I do these methods on a recordset that is empty in the first places, I run into an error.
Is there a way for me to avoid this, so that when the recordset is empty, I can tell the function to return a zero value instead?
Thanks in advance.
-
To see if the recordset contains any records at all, I test for .EOF. As you've found, .MoveLast will error if there are no records.
-
Thanks Paul.
I'll implement your solution now.
-
Paul, it works!
I'm so excited.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules