By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,228 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Security- disabling DB copies

P: 37
Hi, I have an Access 2003 DB that will be installed on XP home in a local club. Several members will be able to use this DB and I am concerned that someone might one day take a copy of the members data home with them on a pendrive.

I can't stop file copying at the OS level, so I am thinking of scattering a few VBA lines to read hidden files in the system area and generate errors when the DB is run on another machine. I know its a game of cat and mouse but I believe 99% of the members would give up on the copy after a few errors..

Has anyone done something similar or know of a better way?
Apr 20 '10 #1

✓ answered by ADezii

@garfieldsevilla
  1. Declare the following Public Constant in a Standard Code Module. This CONSTANT represents the Unique String that must exist in the Registry of a PC before the Database will Open. You can, and probably should, change it to something more appropriate.
    Expand|Select|Wrap|Line Numbers
    1. '******************************************************
    2. 'Define your Unique String to Open the DB
    3. Public Const conOPEN_ID As String = "2356GGF66KKL"
    4. '******************************************************
    5.  
  2. Execute the following code only ONCE. The exception to this Rule would be if and when you wanted to change the Password. This code actually writes the super-duper, top-secret, String to the System Registry at a specific location. Do not proceed if you do not see the Confirmation Dialog!
    Expand|Select|Wrap|Line Numbers
    1. 'Write this String to the Registry of the Club PC, ONLY ONCE, unless
    2. 'you wish to change the Password in the future
    3. SaveSetting appname:="MyApp", Section:="OpenSesame", _
    4.             Key:="Password", setting:=conOPEN_ID
    5.   MsgBox "Registry has been modified!", vbInformation, "Registry Change"
  3. Place the following code in the Open() Event of your Start Up Form.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Open(Cancel As Integer)
    2. Dim strRetVal As String
    3. 'appname, Section, and Key must match 'EXACTLY'
    4. strRetVal = GetSetting(appname:="MyApp", Section:="OpenSesame", _
    5.                         Key:="Password", Default:="YaDa")
    6.  
    7. If strRetVal <> conOPEN_ID Then
    8.   MsgBox "You are not authorized to Open this Database on this PC!", _
    9.           vbCritical, "Illegal Access"
    10.             DoCmd.Quit acQuitSaveNone
    11. End If
    12.  
    13. 'If you get here, Password Identified, you are good to go!
    14. End Sub
  4. Simply stated, if the PC on which the Database resides contains the Unique String in the System Registry, it will Open, if not the User will be warned that he/she are not authorized to use the Database on their PC, and the Database abruptly Terminates.
P.S. - There are work-around the above mechanism, but for obvious reasons, I'll not list them here. There are also other Methods to avoid intrusion upon the Data in the Database from other PCs which I also will not discuss. If you have any further interest, or questions, let me know and I'll address them in a Private Message to you, if warranted.

Share this Question
Share on Google+
8 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I would suggest moving the data to a backend database and password protecting the folder the backend is in. You can also password protect the file itself.
Apr 22 '10 #2

P: 37
Unfortunately, there is no backend- the database is installed on the club's only PC.
Apr 22 '10 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
@garfieldsevilla
That doesn''t mean you can't split the backend out into another database.

Just create a new database file and import all the tables into it. Password protect the new database file. Then replace the tables in the old database with links to the tables in the new database. Now all the data is stored in the new database which is password protected and the database all the users access is only a frontend with no data.
Apr 23 '10 #4

ADezii
Expert 5K+
P: 8,699
@garfieldsevilla
You could have the Database on the Club PC read a specific String from the System Registry on that PC prior to opening. This String will only exist on the Club PC and no other, if it cannot read the Registry Value, do not allow the DB to Open as would be the case on any other PC. A savvy User, of course, could always Import or Link to the copied DB Objects.
Apr 23 '10 #5

P: 37
ADezii, have you done something like this? Can you share any VBA code?

The db is password protected but the problem is that there is at least one easy to use programme that can unlock an access DB. I like the idea of some VBA code to stop the DB from opening on another machine.
Apr 23 '10 #6

ADezii
Expert 5K+
P: 8,699
@garfieldsevilla
  1. Declare the following Public Constant in a Standard Code Module. This CONSTANT represents the Unique String that must exist in the Registry of a PC before the Database will Open. You can, and probably should, change it to something more appropriate.
    Expand|Select|Wrap|Line Numbers
    1. '******************************************************
    2. 'Define your Unique String to Open the DB
    3. Public Const conOPEN_ID As String = "2356GGF66KKL"
    4. '******************************************************
    5.  
  2. Execute the following code only ONCE. The exception to this Rule would be if and when you wanted to change the Password. This code actually writes the super-duper, top-secret, String to the System Registry at a specific location. Do not proceed if you do not see the Confirmation Dialog!
    Expand|Select|Wrap|Line Numbers
    1. 'Write this String to the Registry of the Club PC, ONLY ONCE, unless
    2. 'you wish to change the Password in the future
    3. SaveSetting appname:="MyApp", Section:="OpenSesame", _
    4.             Key:="Password", setting:=conOPEN_ID
    5.   MsgBox "Registry has been modified!", vbInformation, "Registry Change"
  3. Place the following code in the Open() Event of your Start Up Form.
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Form_Open(Cancel As Integer)
    2. Dim strRetVal As String
    3. 'appname, Section, and Key must match 'EXACTLY'
    4. strRetVal = GetSetting(appname:="MyApp", Section:="OpenSesame", _
    5.                         Key:="Password", Default:="YaDa")
    6.  
    7. If strRetVal <> conOPEN_ID Then
    8.   MsgBox "You are not authorized to Open this Database on this PC!", _
    9.           vbCritical, "Illegal Access"
    10.             DoCmd.Quit acQuitSaveNone
    11. End If
    12.  
    13. 'If you get here, Password Identified, you are good to go!
    14. End Sub
  4. Simply stated, if the PC on which the Database resides contains the Unique String in the System Registry, it will Open, if not the User will be warned that he/she are not authorized to use the Database on their PC, and the Database abruptly Terminates.
P.S. - There are work-around the above mechanism, but for obvious reasons, I'll not list them here. There are also other Methods to avoid intrusion upon the Data in the Database from other PCs which I also will not discuss. If you have any further interest, or questions, let me know and I'll address them in a Private Message to you, if warranted.
Apr 23 '10 #7

P: 37
thank you, this is very complete.
Apr 26 '10 #8

ADezii
Expert 5K+
P: 8,699
@garfieldsevilla
You are quite welcome.
Apr 26 '10 #9

Post your reply

Sign in to post your reply or Sign up for a free account.