473,396 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Preventing User accessiblity to .mdb

RLN
RE: Access 2003
Current setup is: Front end .mdb (Interface, queries, macros, etc) /Back
end .mdb (Database Tables)

I'm trying to write some code that will prevent users from getting into
the code (ie. right clicking for form design mode, F11 for the
container, etc.)

I'm testing this with two buttons on a form in a very simple app
containing one table with 3 columns, 2 rows of data and one form based
on the table I just described.

This form has two buttons:
"Set Access App Properties for User"
"Set Access App Properties for Developer"

(A word about ".mde's: I know you might suggest making an .mde and
saving off the .mdb as source to the developer. I have way too much
code in my production app at this point, and I'm nervous about making
the .mde for fear it won't run properly and will generate loads of more
errors that frankly, I don't have time to fix at this point. Deployment
is about 5 days away and I can't risk a setback that the .mde might
bring to my project. To that end, I'm trying to set these properties
with code to better secure my applicaiton.

Basically in my test app here when I click
"Set Access Properties for User" I need these removed:
-right-click capability
-ability to press f11 to get to the DB.
-menus to be removed that would allow them to go into design mode and
create or modify objects.

...then when I click "Set Access Properties for Developer"
I need the above restored.
Here is what I have so far but it is not working right:

<begin code>
Public Function SetAccessAppProperties()
'This is run when "Set Access Properties for User" is clicked
'This sets the properties at the Microsoft Access Development Tool
level normally done via Tools/Options.

Dim db As Database

On Error Resume Next
Set db = CurrentDb()

'hide the main menu bar from users
Application.CommandBars("Menu Bar").Enabled = False

'these toolbars have the DatabaseWindow icon on them by default
DoCmd.ShowToolbar "Form View", acToolbarNo
DoCmd.ShowToolbar "Print Preview", acToolbarNo
ChangeProperty "AllowShortCutMenus", dbBoolean, False
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowToolbarChanges", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False

Set db = Nothing
On Error GoTo 0

End Function
Public Function ResetAccessAppProperties()
'This is run when "Set Access Properties for Developer" is clicked
'This sets the properties back at the Microsoft Access Development
Tool level normally done via Tools/Options.

Dim db As Database

MsgBox "Begin ResetAccessAppProperties"

On Error Resume Next
Set db = CurrentDb()

db.Properties("StartupShowDBWindow") = True
DoCmd.ShowToolbar "Form View", acToolbarYes
DoCmd.ShowToolbar "Print Preview", acToolbarYes
ChangeProperty "AllowShortCutMenus", dbBoolean, True
ChangeProperty "StartupShowDBWindow", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowToolbarChanges", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True

'set MenuBar back to default with
'Application.MenuBar = ""

'hide the main menu bar from users
Application.CommandBars("Menu Bar").Enabled = True

Set db = Nothing

On Error GoTo 0

End Function
Public Function ChangeProperty(strPropName As String, varPropType As
Variant, varPropValue As Variant) As Integer

Dim dbs As Database
Dim prp As Property
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo Change_Err

MsgBox "Changing property for: " & " & strpropname & " - " &
varproptype & " - " & varpropvalue"

dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
<end code>

*** Sent via Developersdex http://www.developersdex.com ***
Jul 1 '08 #1
1 2269
I suggest that you consider setting these properties from a second
application; in that way the state of the properties will not
interfere with your code's ability to set them.
For an example see:
http://www.ffdba.com/downloads/Reset...Properties.htm
(This defaults all the properties; one would change the boolean and
string values to disable them.)

On Jul 1, 3:36*pm, RLN <nospam...@devdex.comwrote:
RE: Access 2003
Current setup is: Front end .mdb (Interface, queries, macros, etc) /Back
end .mdb (Database Tables)

I'm trying to write some code that will prevent users from getting into
the code (ie. right clicking for form design mode, F11 for the
container, etc.)

I'm testing this with two buttons on a form in a very simple app
containing one table with 3 columns, 2 rows of data and one form based
on the table I just described.

This form has two buttons:
"Set Access App Properties for User"
"Set Access App Properties for Developer"

(A word about ".mde's: *I know you might suggest making an .mde and
saving off the .mdb as source to the developer. *I have way too much
code in my production app at this point, and I'm nervous about making
the .mde for fear it won't run properly and will generate loads of more
errors that frankly, I don't have time to fix at this point. *Deployment
is about 5 days away and I can't risk a setback that the .mde might
bring to my project. *To that end, I'm trying to set these properties
with code to better secure my applicaiton.

Basically in my test app here when I click
"Set Access Properties for User" I need these removed:
-right-click capability
-ability to press f11 to get to the DB.
-menus to be removed that would allow them to go into design mode and
create or modify objects.

..then when I click "Set Access Properties for Developer"
I need the above restored.

Here is what I have so far but it is not working right:

<begin code>
Public Function SetAccessAppProperties()
* * 'This is run when "Set Access Properties for User" is clicked
* * 'This sets the properties at the Microsoft Access Development Tool
level normally done via Tools/Options.

* * Dim db As Database

On Error Resume Next
* * Set db = CurrentDb()

* * 'hide the main menu bar from users
* * Application.CommandBars("Menu Bar").Enabled = False

* * 'these toolbars have the DatabaseWindow icon on them by default
* * DoCmd.ShowToolbar "Form View", acToolbarNo
* * DoCmd.ShowToolbar "Print Preview", acToolbarNo
* * ChangeProperty "AllowShortCutMenus", dbBoolean, False
* * ChangeProperty "StartupShowDBWindow", dbBoolean, False
* * ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
* * ChangeProperty "AllowFullMenus", dbBoolean, False
* * ChangeProperty "AllowToolbarChanges", dbBoolean, False
* * ChangeProperty "AllowBreakIntoCode", dbBoolean, False
* * ChangeProperty "AllowSpecialKeys", dbBoolean, False
* * ChangeProperty "AllowBypassKey", dbBoolean, False

* * Set db = Nothing
On Error GoTo 0

End Function

Public Function ResetAccessAppProperties()
* * 'This is run when "Set Access Properties for Developer" is clicked
* * 'This sets the properties back at the Microsoft Access Development
Tool level normally done via Tools/Options.

* * Dim db As Database

* * MsgBox "Begin ResetAccessAppProperties"

On Error Resume Next
* * Set db = CurrentDb()

* * db.Properties("StartupShowDBWindow") = True
* * DoCmd.ShowToolbar "Form View", acToolbarYes
* * DoCmd.ShowToolbar "Print Preview", acToolbarYes
* * ChangeProperty "AllowShortCutMenus", dbBoolean, True
* * ChangeProperty "StartupShowDBWindow", dbBoolean, True
* * ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
* * ChangeProperty "AllowFullMenus", dbBoolean, True
* * ChangeProperty "AllowToolbarChanges", dbBoolean, True
* * ChangeProperty "AllowBreakIntoCode", dbBoolean, True
* * ChangeProperty "AllowSpecialKeys", dbBoolean, True

* * 'set MenuBar back to default with
* * 'Application.MenuBar = ""

* * 'hide the main menu bar from users
* * Application.CommandBars("Menu Bar").Enabled = True

* * Set db = Nothing

On Error GoTo 0

End Function

Public Function ChangeProperty(strPropName As String, varPropType As
Variant, varPropValue As Variant) As Integer

* * Dim dbs As Database
* * Dim prp As Property
* * Const conPropNotFoundError = 3270

* * Set dbs = CurrentDb
*On Error GoTo Change_Err

* * MsgBox "Changing property for: " & " & strpropname & " - " &
varproptype & " - " & varpropvalue"

* * dbs.Properties(strPropName) = varPropValue
* * ChangeProperty = True

Change_Bye:
*Exit Function

Change_Err:
*If Err = conPropNotFoundError Then ' Property not found.
* * Set prp = dbs.CreateProperty(strPropName, varPropType, varPropValue)
* * dbs.Properties.Append prp
* * Resume Next
*Else
* * ' Unknown error.
* * ChangeProperty = False
* * Resume Change_Bye
* * End If
End Function
<end code>

*** Sent via Developersdexhttp://www.developersdex.com***
Jul 2 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Bruce | last post by:
I have a number of forms that do significant work based on variables POSTed from the form. What is the common method of detecting and preventing this work from being done when the form is POSTed as...
7
by: Matt | last post by:
I have an interactive web page that I need to prevent refreshes on. The problem is that I want to ALLOW resubmissions, but only via the submit button. My web page has two forms on it, one form for...
5
by: Fred | last post by:
Hi out there, I have problems finding a way to warn a user that another user intends soon to update the same specific row. Let me explain. User 1 get to a JSP "update customer record" page....
8
by: CJM | last post by:
How do people go about preventing the user from submitting a form for a 2nd time? For example, the user submits a form, clicks on the back button, and the submits the form again. I have used...
18
by: Elroyskimms | last post by:
I have a table using an identity column as its Primary Key and two columns (table reduced for simplicity) EmployeeNumber and ArrivalTime. CREATE TABLE ( IDENTITY (1, 1) NOT NULL , (10)...
3
by: shortbackandsides.no | last post by:
I've been having trouble preventing users pressing Enter part way down a form so the incomplete form gets submitted. I came up with a possible solution - the code below seems to work in both...
1
by: Eike | last post by:
Hi, I am unable to delete a subfolder that I have created programatically. I am using a modification of the apiSHFileOperation by Dev Ashish (http://www.mvps.org/access/api/api0026.htm) to copy...
5
by: Petec | last post by:
Is there a way to prevent a form from getting focus? Thanks! - Pete
3
by: joexoxox | last post by:
Here is the deal , I'm writing a function that makes the user guess for a number already set by me , the user will enter a single digit number , and if it exists , it's printed in its right position...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.