I've been working to solve the exact same problem in my own project, and I BELIEVE that this code will do what you want (although it may not be very efficient). Unfortunately it does NOT work in my case as I'm using a .ADP project (Access front-end with SQLServer back-end).
Good luck, please...