In Lesson 2 you state that you should always clean up after yourself by closing the record set and db. (Lesson 2 at 14:45)
That being the case - shouldn't the "ExitDLookupPlus:" label be placed just before rs.Close so that you properly close down the memory? (Lesson 3 around 25:53)
Yeah, that's not a bad idea. However if you do that and your recordset never opened properly in the first place, the rs.Close might throw an error and you'd get an endless loop. I'd have to try it to be sure. The BEST thing to do is to examine the field, table, and criteria that are sent in FIRST to make sure they're valid.
Maybe the better solution to not have looping code would be to place a different label before rs.close Say "CleanUp:" Then at the end of the error code, assuming you are exiting the Sub put a "Resume Cleanup"
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Developer 17.