Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switching off the 'Right Click' function 2

Status
Not open for further replies.

InkyRich

Technical User
Aug 2, 2006
126
GB
Hello,
I need to turn off the right-click access to the design of a form.
I have been using the code:
ChangeProperty "AllowBypassKey", DB_BOOLEAN, False
to turn off other facilities is there one I can use for turning off the right click?

Inky


A fool and his money are soon parted - so you might as well send it to me!
 
But of course, if you want them to "right-click" and copy/paste, then that sorta throws a wrench in it if I remember correctly. I did that on a form I use myself, and I have to remember that I have to use <ctrl> and c/v.

--

"If to err is human, then I must be some kind of human!" -Me
 
You can always build your own menus and toolbars.
 
No, thanks Remou 'AllowShortcutMenus to False' will do me fine.
Many thanks
Inky

A fool and his money are soon parted - so you might as well send it to me!
 
Hello again Remou,
It appears that the code 'AllowShortcutMenus = False' does not turn off the right-click action. Is there another line that will do this?

Inky

A fool and his money are soon parted - so you might as well send it to me!
 
Hi Inky

You probably need a little code.

Code:
Public Sub SetProp(PropName As String, PropVal As Variant, Optional PropType = dbText)
   Dim db As Object
   Dim prp As Object
   Dim strTitle As String

   Const PROPERTY_NOT_FOUND As Integer = 3270

   On Error GoTo ErrorHandler

   Set db = CurrentDb

   ' Try to set the property. If it fails, the property does not exist.
   db.Properties(PropName) = PropVal

ExitLine:
   db.Close
   Set db = Nothing
   Set prp = Nothing
   Exit Sub

ErrorHandler:
   If Err.Number = PROPERTY_NOT_FOUND Then
      ' Create the new property.
      Set prp = db.CreateProperty(PropName, PropType, PropVal)
      db.Properties.Append prp
      Resume Next
   Else
      Resume ExitLine
   End If

End Sub

'Usage
Setprop "AllowShortcutMenus",False,dbBoolean
 
Thanks Remou,
It appears that I made a mistake and the code "AllowShortcutMenus" does work.
Apologies and thanks for your help.
Have another star!

Inky

A fool and his money are soon parted - so you might as well send it to me!
 
InkyRich,

Unfortunately, you can only give one star per thread (from yourself). But I'll toss one in for ya. [wink]
Besides, I might could use that little snippet of code sometime, or at least the idea.

--

"If to err is human, then I must be some kind of human!" -Me
 
Hi kjv1611,
As you were interested in the last line of code I thought that you might like all of code you will need to turn of all of the Start-up settings:

Code:
            ChangeProperty "StartupShowDBWindow", DB_BOOLEAN, True
            ChangeProperty "StartupShowStatusBar", DB_BOOLEAN, True
            ChangeProperty "AllowBuiltinToolbars", DB_BOOLEAN, True
            ChangeProperty "AllowFullMenus", DB_BOOLEAN, True
            ChangeProperty "AllowBreakIntoCode", DB_BOOLEAN, True
            ChangeProperty "AllowSpecialKeys", DB_BOOLEAN, True
            ChangeProperty "AllowBypassKey", DB_BOOLEAN, True
            ChangeProperty "AllowShortcutMenus", DB_BOOLEAN, True

Of course you change all the 'True's to False accordingly

Inky

A fool and his money are soon parted - so you might as well send it to me!
 
Hmm, thanks a lot! That very well might be helpful at some point in time.

--

"If to err is human, then I must be some kind of human!" -Me
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top