Hi everyone,
I've searched the forums for an answer to this question and nothing jumps out at me.
When a database is opened I want to automatically run code (at start-up) that compares the path of the opened database to a specific path (where the original database is located). This is for security reasons - I need to know if the original database has been copied without authorisation. Due to network issues I cannot use intrinsic MSAccess groups and permissions and have setup security that operates from within Access - ie log in table, and of course the original database is vulnerable to being copied.
This is the very bare bones - very basic code for the comparison (don't laugh - in this format its just for testing to see how I can get it to load at startup - it works fine though).
Expand|Select|Wrap|Line Numbers
- Sub MYPATH()
- Dim MYPATH
- MYPATH = CurDir
- If MYPATH = "<server_name>\<path>\<file_name>" Then acCmdOpenStartPage
- MsgBox "NoNo", vbOKOnly, "!!!!!!! ILLEGAL COPY DETECTED!!!!!!!!"
- End If
- End Sub
The startup options in Access only allow me to open a form, load a menu bar, a shortcut menu, or set the bypass key.
So to get to the point of this post - can you script an autorun on open type event in Access? That is can my dir/path script be made to run each time a database is opened? If so, can anyone point me in the right direction on how to go about this? (I'm happy to have a go at working out the scripting myself, just need some guidance on how to). I'm also very willing to be guided on improving the above code (remember though that this is just a two second job for testing)
Thanks everyone =)