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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to set startup option "Allow Default Shortcut Menus" via VBA? 1

Status
Not open for further replies.

sudakov

Programmer
Joined
Jun 17, 2007
Messages
53
Location
US
Hi everybody,
does anybody know how to set startup option "Allow Default Shortcut Menus" via VBA?

I tried the following:

Code:
Application.SetOption "AllowDefaultShortcutMenus"), False

and

Code:
CurrentDb.Properties("AllowDefaultShortcutMenus") = False

No success for now.

Does anybody can help?

sudakov
 
Code:
  'Usage: Setprop "AllowShortcutMenus",False,dbBoolean
   
  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

From:
 
Remou,
it works!
Thank you very much.

sudakov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top