Connecting Tech Pros Worldwide Help | Site Map

A97 trying to set shortcutmenu=false for all forms

MLH
Guest
 
Posts: n/a
#1: Nov 13 '05
I would like to change ShortcutMenu property setting
to No for all forms - permanently. I tried this code...

Private Sub Command0_Click()
Dim frm As Form, ctl As Control

For Each frm In Forms
Debug.Print frm.Name
With frm
.ShortcutMenu = False
End With
Next frm
End Sub

Above code doesn't seem to be working. Only
a single formname is printed in debug window
(the current form in which this snippet resides).
After running the code, the property is set. How
can I save the setting permanently with all the
forms. Apparently, code is doing this only for
open forms.
Rick Brandt
Guest
 
Posts: n/a
#2: Nov 13 '05

re: A97 trying to set shortcutmenu=false for all forms


MLH wrote:[color=blue]
> I would like to change ShortcutMenu property setting
> to No for all forms - permanently. I tried this code...
>
> Private Sub Command0_Click()
> Dim frm As Form, ctl As Control
>
> For Each frm In Forms
> Debug.Print frm.Name
> With frm
> .ShortcutMenu = False
> End With
> Next frm
> End Sub
>
> Above code doesn't seem to be working. Only
> a single formname is printed in debug window
> (the current form in which this snippet resides).
> After running the code, the property is set. How
> can I save the setting permanently with all the
> forms. Apparently, code is doing this only for
> open forms.[/color]

Why not just disable the shortcut menus in the Startup properties?

--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com


MLH
Guest
 
Posts: n/a
#3: Nov 13 '05

re: A97 trying to set shortcutmenu=false for all forms


That is DEFINITELY the ticket. Many thx.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[color=blue]
>
>Why not just disable the shortcut menus in the Startup properties?[/color]

Wayne Gillespie
Guest
 
Posts: n/a
#4: Nov 13 '05

re: A97 trying to set shortcutmenu=false for all forms


On Fri, 07 Oct 2005 06:16:50 -0400, MLH <CRCI@NorthState.net> wrote:
[color=blue]
>I would like to change ShortcutMenu property setting
>to No for all forms - permanently. I tried this code...
>
>Private Sub Command0_Click()
> Dim frm As Form, ctl As Control
>
> For Each frm In Forms
> Debug.Print frm.Name
> With frm
> .ShortcutMenu = False
> End With
> Next frm
>End Sub
>
>Above code doesn't seem to be working. Only
>a single formname is printed in debug window
>(the current form in which this snippet resides).
>After running the code, the property is set. How
>can I save the setting permanently with all the
>forms. Apparently, code is doing this only for
>open forms.[/color]

Rick's suggestion is the obvious solution.
To answer why your code isn't working -

You are looping the forms collection which only contains the forms that are actually open at the time. To loop All forms
in the database you need to loop the forms CONTAINER.
Something like -

Dim I As Integer
Dim Db as Database

Set Db = CurrentDb()
For I = 0 To .Containers(1).Documents.Count - 1
DoCmd.OpenForm Db.Containers(1).Documents(I).Name, acDesign
Forms(Db.Containers(1).Documents(I).Name).Shortcut Menu = False
DoCmd.Close acForm, Db.Containers(1).Documents(I).Name, acSaveYes
Next

Set Db = Nothing


Larry Linson
Guest
 
Posts: n/a
#5: Nov 13 '05

re: A97 trying to set shortcutmenu=false for all forms


The Forms Collection only contains Open Forms. If you want to do a
programmatic operation on all Forms, start with the Forms Container, or use
the AllForms Collection. I also think, for permanently changing a Property,
you may have to open the Form in Design View, set the Property, then Close
the Form.

Larry Linson
Microsoft Access MVP

"MLH" <CRCI@NorthState.net> wrote in message
news:l5ick1tq1simhjrk6rti4k54kpkf61opgp@4ax.com...[color=blue]
>I would like to change ShortcutMenu property setting
> to No for all forms - permanently. I tried this code...
>
> Private Sub Command0_Click()
> Dim frm As Form, ctl As Control
>
> For Each frm In Forms
> Debug.Print frm.Name
> With frm
> .ShortcutMenu = False
> End With
> Next frm
> End Sub
>
> Above code doesn't seem to be working. Only
> a single formname is printed in debug window
> (the current form in which this snippet resides).
> After running the code, the property is set. How
> can I save the setting permanently with all the
> forms. Apparently, code is doing this only for
> open forms.[/color]


Closed Thread