Protect Data

  • Thread starter Thread starter ChuckW
  • Start date Start date
C

ChuckW

Hi,

I am building an application in forms and want to protect
my data from end users. I know there is a way to do this
that prevent people from closing a form and viewing the
tables. When you hold down the shift key then you have
access to everything. Can someone tell me how to do this?

Thanks,

Chuck
 
Here is one way to do it: Only do this on a backup copy of your mdb.
It is very easy to "lock yourself out forever."

Create two buttons on the Startup form: one to call SetFullStartUpProperties
and another to callSetLimitedStartupProperties.

Change their visible property so that only you can see them.
If CurrrentUser() = "joe" Then
Me![btn1].Visible=True
Me![btn2].Visible=True
Else
Me![btn1].Visible=False
Me![btn2].Visible=False
End If

Click the Limited button, close the mdb and re-open.

Code behind the Limited button:
DoCmd.Hourglass True
SetLimitedStartupProperties
DoCmd.Hourglass False
MsgBox ("Limited start up options set.")

You will be locked out of the database window.

The *only way* to get it back is to click the Full Button.
This is why you have to practice on a copy!!!

Put this code in a module:

Sub SetFullStartupProperties()
ChangeProperty "StartupForm", dbText, "Startup",True
ChangeProperty "StartupShowDBWindow", dbBoolean, False,True
ChangeProperty "StartupShowStatusBar", dbBoolean, True,True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True,True
ChangeProperty "AllowToolbarChanges", dbBoolean, True,True
ChangeProperty "AllowFullMenus", dbBoolean, True,True
ChangeProperty "AllowShortcutMenus", dbBoolean, True,True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True,True
ChangeProperty "AllowSpecialKeys", dbBoolean, True,True
ChangeProperty "AllowBypassKey", dbBoolean, True,True
End Sub

Sub SetLimitedStartupProperties()
ChangeProperty "StartupForm", dbText, "Startup",True
ChangeProperty "StartupShowDBWindow", dbBoolean, False,True
ChangeProperty "StartupShowStatusBar", dbBoolean, True,True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False,True
ChangeProperty "AllowToolbarChanges", dbBoolean, False,True
ChangeProperty "AllowFullMenus", dbBoolean, False,True
ChangeProperty "AllowShortcutMenus", dbBoolean, False,True
ChangeProperty "AllowBreakIntoCode", dbBoolean, False,True
ChangeProperty "AllowSpecialKeys", dbBoolean, False,True
ChangeProperty "AllowBypassKey", dbBoolean, False,True
End Sub

Function ChangeProperty(stPropName As String, _
PropType As DAO.DataTypeEnum, vPropVal As Variant) _
As Boolean
' Uses the DDL argument to create a property
' that only Admins can change.
'
' Current CreateProperty listing in Access help
' is flawed in that anyone who can open the db
' can reset properties, such as AllowBypassKey
'
On Error GoTo ChangeProperty_Err

Dim db As DAO.Database
Dim prp As DAO.Property

Const conPropNotFoundError = 3270

Set db = CurrentDb
' Assuming the current property was created without
' using the DDL argument. Delete it so we can
' recreate it properly
db.Properties.Delete stPropName
Set prp = db.CreateProperty(stPropName, _
PropType, vPropVal, True)
db.Properties.Append prp

' If we made it this far, it worked!
ChangeProperty = True

ChangeProperty_Exit:
Set prp = Nothing
Set db = Nothing
Exit Function

ChangeProperty_Err:
If Err.Number = conPropNotFoundError Then
' We can ignore when the prop does not exist
Resume Next
End If
Resume ChangeProperty_Exit
End Function
 
Hi Chuck,

You need to use User-Level Security and disable the bypass key. See for
tips: How To: Enforce or Disable the Startup Options in an Access Database
Project
http://support.microsoft.com/default.aspx?scid=kb;en-us;826765

I hope this helps! If you have additional questions on this topic, please
respond back to this posting.


Regards,

Eric Butts
Microsoft Access Support

"Microsoft Security Announcement: Have you installed the patch for
Microsoft Security Bulletin MS03-026? If not Microsoft strongly advises
you to review the information at the following link regarding Microsoft
Security Bulletin MS03-026
<http://www.microsoft.com/security/security_bulletins/ms03-026.asp> and/or
to visit Windows Update at <http://windowsupdate.microsoft.com/> to install
the patch. Running the SCAN program from the Windows Update site will help
to insure you are current with all security patches, not just MS03-026."


--------------------
| Content-Class: urn:content-classes:message
| From: "ChuckW" <[email protected]>
| Sender: "ChuckW" <[email protected]>
| Subject: Protect Data
| Date: Wed, 28 Jan 2004 13:29:55 -0800
| Lines: 11
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Thread-Index: AcPl5d9KMYsM+d60TRCgNON3dQAeZQ==
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Newsgroups: microsoft.public.access.forms
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.access.forms:252658
| NNTP-Posting-Host: tk2msftngxa12.phx.gbl 10.40.1.164
| X-Tomcat-NG: microsoft.public.access.forms
|
| Hi,
|
| I am building an application in forms and want to protect
| my data from end users. I know there is a way to do this
| that prevent people from closing a form and viewing the
| tables. When you hold down the shift key then you have
| access to everything. Can someone tell me how to do this?
|
| Thanks,
|
| Chuck
|
 
Here is one way to do it: Only do this on a backup copy of your mdb.
It is very easy to "lock yourself out forever."

A common misconception, Joe. Any member of the Admins group can reset the
database properties to whatever values they want.

TC
 
Hi,

I probably don't need much in the way of security. I
have an application now that someone wrote for me. When
I open it, I cannot X out of a form and access the data,
queries or reports. However, when I hold the shift key
down I can access these objects. Is there a way to
duplicate this. I am building an application and I don't
think any end users will know about the holding down the
shift key so this will be good enough. Do I need to
create user level security or can I simply make a setting
that prevents anyone from accessing any tables unless
they hold down the shift key?

Thanks,

Chuck
 
From Tools:Startup, uncheck Show Database Window and choose some form
to display at startup.

You do need something else to prevent "X-ing out of a form".
 
Back
Top