Link to home
Start Free TrialLog in
Avatar of softsupport
softsupportFlag for United States of America

asked on

How to fully lock an access database

I have an access database that I need to limit access to only forms (in ordert to add, edit and save data in tables)  However, do not want users to have access to programming code, queries, etc)
(Reason: Have installed database in the past and several employees thinking they know how to program in access have made adjustments and caused errors in database.)  I am aware of the security wizard, but aren't there ways around it?)  I want to lock this completely down if possible.
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

You can create an MDE from the MDB.  This will 'lock' vba code, and users will not be able to open forms or reports in Design view.

mx
SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of softsupport

ASKER

To make sure I understand:

I must backup, do a DECOMPILE, and then create a MDE from the MBD.  
Once this is done, no one will be able to access code, queries, etc.  When I need to make changes to database again.... Will I be able to?   Sorry, pretty inept in this security thing.  And what about the User-Level Security in Access... not needed?  No access will be granted in the MDE file?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
So the Access security will secure all that I set at user level?  And was it the MDE that is not 100% or Access Security also.  Is it possible for the database to be accessed if security is enabled?  I know nothing is 100%, but what is the closest?  How do you hide objects?
I have created the database on a laptop and will install on a server.  Can the security be setup on the laptop and then install database on server?  Laptop is running Access 2003, machines accessing server are running Access 2007.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sonchoy
sonchoy

You can also lock down your VBA code. Goto your VBA editor
Tools>your database properties
Click on protection, then check lock project for viewing and create a password.
This will prevent your user or anyone to from changing your VBA code if they don't know password
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Once you create a MDE, you can't go back to your MDB file. You have to have a Back up of your MDB file before you create a MDE. That's I avoid creating MDE.
When you create an MDE you have an MDB file let's say its called MyDatabase.MDB then you tell it to create an MDE file called MyDatabase.MDE ( I normally create it in a different folder, you don't overwrite the MDB file with the MDE and you continue to develop in the MDB but distribute the newly built MDE.
Cheers, Andrew
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well, let the author decide it which is best for him/her
Ok.... tried to do the .MDE..... received error message.  Did the COMPILE, received error message in the COMPILE, but the code works.  What to do now?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Here is the code with error message


Error message says "Compile error"  Else without IF.  I put a message in parenthesis the ELSE that is erroring out.
 
 
Public Function CompareMeals(DisAllow As Long, McAtt As Long, McOrd As Long, McCap As Long) As Long
If [DisAllow] > [McAtt] Then
    If [DisAllow] > [McOrd] Then
        If [DisAllow] > [McCap] Then
        CompareMeals = DisAllow
    Else
        CompareMeals = McOrd
            Else   (this is the Else it is erroring out on)
            CompareMeals = McCap
    End If
          End If
Else
    If [McAtt] > [McOrd] Then
        CompareMeals = McAtt
    Else
        CompareMeals = McOrd
    End If
End If
 
Else
    If [McOrd] > [McCap] Then
        CompareMeals = McOrd
    Else
        CompareMeals = McCap
    End If
End If
 
End Function

Open in new window

You can't do  If, If, Else, Else you have to do an Endif before the 2nd else
Cheers, Andrew
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Actually, there are more Else's out of place.  

You need to go through and straighten those out.   I'm not sure what logic you intend, so you need to fix those.

If ...

Else

ElseIF

ElseIF

End IF

is the basic structure

mx