469,612 Members | 2,181 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,612 developers. It's quick & easy.

A97 trying to set shortcutmenu=false for all forms

MLH
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.
Nov 13 '05 #1
4 1661
MLH wrote:
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.


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
Nov 13 '05 #2
MLH
That is DEFINITELY the ticket. Many thx.
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

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


Nov 13 '05 #3
On Fri, 07 Oct 2005 06:16:50 -0400, MLH <CR**@NorthState.net> wrote:
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'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
Nov 13 '05 #4
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" <CR**@NorthState.net> wrote in message
news:l5********************************@4ax.com...
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.

Nov 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Bill Reed via AccessMonster.com | last post: by
2 posts views Thread by nate axtell | last post: by
2 posts views Thread by Randall Parker | last post: by
reply views Thread by devrayhaan | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.