This is one of those functions that I use from time to time when it is important that the user is opening a MS Access database from a specific location. This quick little function will determine the file path that the MS Access database resides in, and compares to a specified path. If they match, proceed. If no match, well, do something about it.

You may wonder why you should use something like this, or what is the use case? Some of the times I’ve needed to use this is when dealing with users in multiple environments. Another area in which I use this type of check is when the users may be prone to making their own copy of the database and putting on their desktop. I know, use the front-end/back-end model, but sometimes for something simple you don’t need to go overkill and apply that model.

I won’t put together a working file for this unless someone specifically asks me for it. It’s pretty straight forward in how it works, just call the sub if you want it to check (usually an ‘on open’ event). Enjoy!

Determine MS Access File Path

Tags: