Right Click capability -add-remove

R

RLN

I need to block the user's ability to right click on any form they have
loaded.
I don't want them to have the opportunity to get to design mode via right
click on a form or by pressing F11.

I currently disable the F11 key via a macro "Autokeys" that runs @ startup.
(This autokeys macro also launches the "developer's form" when F10 is
pressed.)

If a developer opens the app and sees a problem, I have a "Developer's
form" that developers can get to when they press F10 & input a password in a
text box on that form.
When this "developer's form" loads, I need to re-enable the right click
ability and re-enable the F11 key so the developer can do maintenance.
Once the developer is done with maintenance I need to once again disable the
shortcut menu ability on all forms and disable the F11 key in the app so
users can't get in there and change stuff.

Is there a simple way to disable/re-enable the right click ability on all
forms via code?

(Yes, I have thought about an MDE as my final product to release to
production, but for now I'm sticking to .mdb's)

RLN
 
D

Douglas J. Steele

Why not just distribute an MDE rather than an MDB?

Remember to keep the MDB for development purposes!
 
R

RLN

Remember to keep the MDB for development purposes! <<
Yes, I recall this being a requirement when deploying .MDE's.
Agreed.

(still working with original .mdb here....)
I have renamed my AutoExec & AutoKeys macros to AutoE1 and AutoK1
respectively so they won't run when the app starts. I was hoping that would
have started the app with full menus, full right click capability, but that
did not work. While F11 does work to get me to the DB Container, the menus
are still disabled and the right click capability is still gone in my .mdb.

How do I (via code) re-enable the right click functionality in my .mdb along
with full menus that are available as default so I can work in there when
working with all objects in the DB container?

Thanks.
 
D

Douglas J. Steele

Take a look at the options available under Tools | Startup. Perhaps you've
told Access not to allow the built-in toolbars.

You could also try holding down the shift key while opening the database,
thus overriding the startup settings.
 
R

RLN

Take a look at the options available under Tools | Startup. Perhaps you've
told Access not to allow the built-in toolbars.<<

I cannot get to this menu option to change it.

After researching this I came up with the following code to try and reset
all of the general Access menu options back to normal in my app so I can make
development changes. I put msgbox messages in my routine to see what
happens, only because I when I set a breakpoint in the code the debugger
never displays.
In the "ResetAccessAppProperties" routine, the last msgbox displayed is
"ResetAccessAppProperties-3". Because of that, I think there is something
wrong with my "ChangeProperty" sub routine. It compiles clean, but unsure
what's causing the problem.

<begin code>
Public Function ResetAccessAppProperties()
Dim db As Database
MsgBox "Begin ResetAccessAppProperties"
On Error Resume Next
Set db = CurrentDb()
db.Properties("StartupShowDBWindow") = True
MsgBox "ResetAccessAppProperties-1"
DoCmd.ShowToolbar "Form View", acToolbarYes
MsgBox "ResetAccessAppProperties-2"
DoCmd.ShowToolbar "Print Preview", acToolbarYes
MsgBox "ResetAccessAppProperties-3"
ChangeProperty "AllowShortCutMenus", dbBoolean, True
MsgBox "ResetAccessAppProperties-4"
ChangeProperty "StartupShowDBWindow", dbBoolean, True
MsgBox "ResetAccessAppProperties-5"
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
MsgBox "ResetAccessAppProperties-6"
ChangeProperty "AllowFullMenus", dbBoolean, True
MsgBox "ResetAccessAppProperties-7"
ChangeProperty "AllowToolbarChanges", dbBoolean, True
MsgBox "ResetAccessAppProperties-8"
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
MsgBox "ResetAccessAppProperties-9"
ChangeProperty "AllowSpecialKeys", dbBoolean, True
MsgBox "ResetAccessAppProperties-10 of 10"
'set MenuBar back to default with
'Application.MenuBar = ""
'hide the main menu bar from users
Application.CommandBars("Menu Bar").Enabled = True
Set db = Nothing
MsgBox "End ResetAccessAppProperties"
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
msgbox "Changing property for:" " & strpropname & "-" & varproptype &
"-" & varpropvalue
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
<end code>

RLN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top