473,783 Members | 2,317 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 SetAccessAppPro perties()
'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.Com mandBars("Menu Bar").Enabled = False

'these toolbars have the DatabaseWindow icon on them by default
DoCmd.ShowToolb ar "Form View", acToolbarNo
DoCmd.ShowToolb ar "Print Preview", acToolbarNo
ChangeProperty "AllowShortCutM enus", dbBoolean, False
ChangeProperty "StartupShowDBW indow", dbBoolean, False
ChangeProperty "AllowBuiltinTo olbars", dbBoolean, False
ChangeProperty "AllowFullMenus ", dbBoolean, False
ChangeProperty "AllowToolbarCh anges", dbBoolean, False
ChangeProperty "AllowBreakInto Code", dbBoolean, False
ChangeProperty "AllowSpecialKe ys", dbBoolean, False
ChangeProperty "AllowBypassKey ", dbBoolean, False

Set db = Nothing
On Error GoTo 0

End Function
Public Function ResetAccessAppP roperties()
'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 ResetAccessAppP roperties"

On Error Resume Next
Set db = CurrentDb()

db.Properties(" StartupShowDBWi ndow") = True
DoCmd.ShowToolb ar "Form View", acToolbarYes
DoCmd.ShowToolb ar "Print Preview", acToolbarYes
ChangeProperty "AllowShortCutM enus", dbBoolean, True
ChangeProperty "StartupShowDBW indow", dbBoolean, True
ChangeProperty "AllowBuiltinTo olbars", dbBoolean, True
ChangeProperty "AllowFullMenus ", dbBoolean, True
ChangeProperty "AllowToolbarCh anges", dbBoolean, True
ChangeProperty "AllowBreakInto Code", dbBoolean, True
ChangeProperty "AllowSpecialKe ys", dbBoolean, True

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

'hide the main menu bar from users
Application.Com mandBars("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 conPropNotFound Error = 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 = conPropNotFound Error Then ' Property not found.
Set prp = dbs.CreatePrope rty(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 2291
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...@devd ex.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 SetAccessAppPro perties()
* * '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.Com mandBars("Menu Bar").Enabled = False

* * 'these toolbars have the DatabaseWindow icon on them by default
* * DoCmd.ShowToolb ar "Form View", acToolbarNo
* * DoCmd.ShowToolb ar "Print Preview", acToolbarNo
* * ChangeProperty "AllowShortCutM enus", dbBoolean, False
* * ChangeProperty "StartupShowDBW indow", dbBoolean, False
* * ChangeProperty "AllowBuiltinTo olbars", dbBoolean, False
* * ChangeProperty "AllowFullMenus ", dbBoolean, False
* * ChangeProperty "AllowToolbarCh anges", dbBoolean, False
* * ChangeProperty "AllowBreakInto Code", dbBoolean, False
* * ChangeProperty "AllowSpecialKe ys", dbBoolean, False
* * ChangeProperty "AllowBypassKey ", dbBoolean, False

* * Set db = Nothing
On Error GoTo 0

End Function

Public Function ResetAccessAppP roperties()
* * '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 ResetAccessAppP roperties"

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

* * db.Properties(" StartupShowDBWi ndow") = True
* * DoCmd.ShowToolb ar "Form View", acToolbarYes
* * DoCmd.ShowToolb ar "Print Preview", acToolbarYes
* * ChangeProperty "AllowShortCutM enus", dbBoolean, True
* * ChangeProperty "StartupShowDBW indow", dbBoolean, True
* * ChangeProperty "AllowBuiltinTo olbars", dbBoolean, True
* * ChangeProperty "AllowFullMenus ", dbBoolean, True
* * ChangeProperty "AllowToolbarCh anges", dbBoolean, True
* * ChangeProperty "AllowBreakInto Code", dbBoolean, True
* * ChangeProperty "AllowSpecialKe ys", dbBoolean, True

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

* * 'hide the main menu bar from users
* * Application.Com mandBars("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 conPropNotFound Error = 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 = conPropNotFound Error Then ' Property not found.
* * Set prp = dbs.CreatePrope rty(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 Developersdexht tp://www.developersd ex.com***
Jul 2 '08 #2

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

Similar topics

5
4617
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 the result of the user clicking the Back or Reload buttons in the browser? --Bruce
7
2115
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 adding users, and one form for removing users. I want to be able to add a user, click the submit button, add another user, click the submit button again, and so on, BUT, disallow adding a user and then hitting refresh (which would add the same...
5
613
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. - The page does a read of the existing record and loads it into the gui fields for edit.
8
2342
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 various techniques in the past (depending on circumstances) but I'd be interested in the techniques you guys currently use. Thanks --
18
27721
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) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL , NOT NULL , CONSTRAINT PRIMARY KEY CLUSTERED (
3
1767
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 mozilla and MSIE - is this a good way to solve the problem? Is there a better alternative? Have I done anything stupid? My aim was to disable the normal submit process then use javascript to submit which appears to bypass that and work...
1
1610
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 the files. A File Copy function is called as part of a loop to copy a series of files from a variety of locations that are stored in the database. All the files are copied to a folder specified by the user. Once the user has used this folder (to...
5
10126
by: Petec | last post by:
Is there a way to prevent a form from getting focus? Thanks! - Pete
3
1446
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 on the screen, like hangman but for numbers :P I am reading the input of the user using scanf and i dont want to use gets, so plz let ur answers differ from that .... Im just checking if the user_number is between 0 and 9 to make sure that it's a...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10313
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10147
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9946
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6735
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4044
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3643
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.