|
Subject:
|
prevention of edit forms/tables
|
|
Posted By:
|
damnnono_86
|
Post Date:
|
11/12/2003 10:18:37 PM
|
hi
how do i prevent user from entering into the 'design view', 'datasheet view' of my form??? how can i prevent them for entering to the database window (where you can choose to create table in design view or wizard.)??
pls advice nono
|
|
Reply By:
|
U.N.C.L.E.
|
Reply Date:
|
11/13/2003 3:52:09 AM
|
First, make a backup of your database! Have you done that yet? Good.
Now, take a look at Tools|Startup menu. There is a checkbox that says "Display Database Window". This dialog controls the menus, menu items, etc. that your user will see when the database first starts up... You can play around with the various settings, but be forewarned that some people have locked themselves out of their own database playing with these settings. Which is why I strongly recommend to make a backup before "playing" with the settings.
One catch: Your user, if sophisticated enough, can bypass your startup settings by holding down the shift key when first opening your database. This will also bypass any autoexec code.
Solution: You have to set the "AllowBypassKey" property to false and add it to the database properties collection. This can only be done via VBA code.
If you're interested in digging deeper... reply appropriately.
|
|
Reply By:
|
SerranoG
|
Reply Date:
|
11/13/2003 7:53:44 AM
|
The Man from UNCLE (insert secret agent music here ) answered the second part of your question. Here's the first part.
After you make your back-up (hint, hint) you click on TOOLS > DATABASE UTILITIES > MAKE MDE FILE. This will turn your MDB into an MDE. An MDE is (sort of) an executable-only version of your database. Access will not let you make an EXE file, but the MDE is close. The MDE will not let you edit or manipulate form designs, etc; and it strips the VBA code out of the database so it's not even visible to the user. Together with UNCLE's (not so secret) advice, this, and then creating custom toolbars, you can keep people out of your database's underwear (so to speak). 
Greg Serrano Michigan Dept. of Environmental Quality, Air Quality Division
|
|
Reply By:
|
sal
|
Reply Date:
|
11/13/2003 9:41:05 AM
|
Since you made a backup. I should not have to say that again. Now, make sure that you do not lock yourself out of your own database by creating a new toolbar. I have had wo many folks ask me to crack their database open because they locked themselves out by creating a new toolbar and setting it as default.
Sal
|
|
Reply By:
|
damnnono_86
|
Reply Date:
|
11/13/2003 9:09:58 PM
|
hi U.N.C.L.E.,
i have heard alot of people saying abt the shift key, could u tell me how can the shift key be used to bypass the autoexec function????
and of course could u guide me on the VBA coding. thanks!
pls advice nono
|
|
Reply By:
|
damnnono_86
|
Reply Date:
|
11/13/2003 10:45:39 PM
|
hi
creating mde file is a good one. i have another question that pops up on my mind when trying the methods..
this database are meant for normal users (those who have no access to coding/tables etc) and admin (those who have access to the tables coding and everything).
i have put in the method u all have taught me. but if in any point of time that i (admin) wish to make some changes to my database so how can i be able to do that??? as i have the access to the tables/coding in my backup database, i can't change from there as that will not be the same as the one where users have make some modification of the datas. so how can i make changes (coding/tables format etc) on the database (the one user is using) that i have disable the 'database window'???
pls advice nono
|
|
Reply By:
|
U.N.C.L.E.
|
Reply Date:
|
11/14/2003 6:29:57 AM
|
You might want to think about creating a FE/BE model. The front end (FE) as the user interface which can be an .MDE format, and the back end (BE) database in one central location which will be your data container.
As for code examples... Direct from MS... Please take a look as this MS web document (search for AllowBypassKey):
http://support.microsoft.com/default.aspx?scid=/support/access/content/secfaq.asp
Good Luck!
P.S. Be sure to back up database before running your AllowBypassKey code!
|
|
Reply By:
|
SerranoG
|
Reply Date:
|
11/14/2003 8:02:47 AM
|
The Man from UNCLE's advice is good... put the tables and queries in an MDB file and put the forms and reports in an MDE and link them.
You can password protect the MDB half with the tables so that users cannot edit them. They will only able to affect the data via the forms in the MDE. The MDE half will be only available in a limted way so they cannot do damage.
Remember to keep an MDB version of the forms and reports so you can upgrade them at a later time. When you upgrade them, turn them into an MDE again and give that to the users again.
Just remember, keep-back ups of everything unprotected with no passwords, etc. somewhere where only you can get at it so if you accidentally get locked out you have the source information.
Greg Serrano Michigan Dept. of Environmental Quality, Air Quality Division
|
|
Reply By:
|
damnnono_86
|
Reply Date:
|
11/16/2003 9:47:23 PM
|
hi,
i have try the method ... regarding the "AllowBypassKey"
but how do i use the special keys (eg.shift key) to open the database???
pls guide me. nono
|
|
Reply By:
|
vladimir
|
Reply Date:
|
11/16/2003 10:38:43 PM
|
Go back to your MDB version of "forms and reports" database to make changes.
Vladimir
|
|
Reply By:
|
tcarnahan
|
Reply Date:
|
11/16/2003 11:43:27 PM
|
To use the shift key to bypass the startup options and autoexec, go to your .MDB file (NOT the .MDE). If you are viewing it in Windows Explorer, hold down the SHIFT key and keep holding it down as you open the .MDB file.
Be sure to read your help files on the subject. The following is from MS ACCESS XP help file: ------------------------------------- Ignore startup options If you used the Startup dialog box (Tools menu) or created an AutoExec macro or an Open event procedure to specify what happens when you open a Microsoft Access application, you can bypass those settings to regain full access to your Access file.
Hold down the Bypass key (the SHIFT key) while you open the database. Note You can disable the bypass key by writing a macro or Microsoft Visual Basic for Applications code that sets the AllowBypassKey property of the database to False.
--------------------------------- Here is some code that will allow you to disable the SHIFT key ... warning: follow the advice of everyone preceding my reply ... only execute this code in a BACKUP of the .MDB file.
This is also from the VBA Editor Help file in MS Access 2000 (could not find it in XP: --------------------------------------
'The following SubRoutine sets the StartUp properties. 'It uses the general purpose procedure ChangeProperty to set the startup properties. 'WARNING: Make a copy of this .MDB file and open it before running this code. This will ' irreversably lock you out of the built-in menus and toolbars, once you close the .MDB file. ' Run ONLY once per copy. NEVER run it in the original .MDB file.
Function SetStartupProperties() 'ChangeProperty "StartupForm", dbText, gcstr_Frm_Switch_Board ' The form to open on Start Up. ChangeProperty "StartupShowDBWindow", dbBoolean, False 'ChangeProperty "StartupShowStatusBar", dbBoolean, False ChangeProperty "AllowBuiltinToolbars", dbBoolean, False ChangeProperty "AllowFullMenus", dbBoolean, False ChangeProperty "AllowBreakIntoCode", dbBoolean, False ChangeProperty "AllowSpecialKeys", dbBoolean, False ChangeProperty "AllowToolbarChanges", dbBoolean, False ChangeProperty "AllowShortcutMenus", dbBoolean, False 'ChangeProperty "StartupMenuBar", dbText, "customStandardMenu" ' This is the ultimate that locks you out from using the "Shift" key to bypass at startup. ChangeProperty "AllowBypassKey", dbBoolean, False '<=== THIS DISABLES "SHIFT"! End Function
'The general purpose procedure ChangeProperty attempts to set the startup 'property and, if the property isn't found, uses the CreateProperty method to append it to the Properties collection 'of the Database object. This is necessary because these properties don't appear in the Properties collection until 'they've been set or changed at least once.
Function ChangeProperty(strPropName As String, varPropType As Variant, varPropValue As Variant) As Integer Dim dbs As Database, prp As Property Const conPropNotFoundError = 3270
Set dbs = CurrentDb On Error GoTo Change_Err 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
--- Tom
|