Solved Change between custom shortcut menu and default with vba (1 Viewer)

hugomadail

Registered User.
Local time
Today, 22:02
Joined
Aug 31, 2018
Messages
25
Hello,

I have a database and made a custom shortcut menu bar (right click menu), which is enabled for all database by setting it up in file > options > current database> ribbon and toolbar options > shortcut menu bar: "ShortcutMenu" (instead of default).

So, I would like to change between "ShortcutMenu" and Default (access default) with a press of a button using vba code. Which means if database had "ShortcutMenu" active, I could press that button and it would change to Default (and that change would be seen in file > options > current database> ribbon and toolbar options > shortcut menu bar).

Can someone help me on this ? is it possible ?
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:02
Joined
Oct 29, 2018
Messages
14,095
Hi. Have you tried Application.SetOptions?

Just thinking out loud...

Sent from phone...
 

hugomadail

Registered User.
Local time
Today, 22:02
Joined
Aug 31, 2018
Messages
25
theDBguy, I dont know which options from Application.SetOptions I should use, but I tried the following (still unsure if this is the right option):

CurrentDb.Properties("StartupShortcutMenuBar") = "ShortcutMenu"

but it returns runtime error 3270 property not found, so I'm still looking to solve this :(

also Im not sure what default would be (CurrentDb.Properties("StartupShortcutMenuBar") = ???)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:02
Joined
Oct 29, 2018
Messages
14,095
theDBguy, I dont know if Application.SetOptions is the right one (search inconclusive), but I tried the following (still unsure if this is the right option):

CurrentDb.Properties("StartupShortcutMenuBar") = "ShortcutMenu"

but it returns runtime error 3270 property not found, so I'm still looking to solve this :(

also Im not sure what default would be (CurrentDb.Properties("StartupShortcutMenuBar") = ???)
Hi. Maybe the name of the property is different.

I don't see it in here, so I'll have to do some checking.

 

hugomadail

Registered User.
Local time
Today, 22:02
Joined
Aug 31, 2018
Messages
25
HiTechCoach,
If I understood right, in that aproach each form would have its own shortcut menu (or the same menu replicated on all forms), I was looking for a more general setting that would apply to all forms thats why I were trying through current database settings (and would still be a good way for a simple and non-specific shortcut menu to all forms). Yet, I could try your aproach but with some "global" code and call it from each form since I have like huh 7/8 forms.

Thank you both for your replies, will feedback when I get time to implement that (might take some time to answer).

On a side note: still wouldnt mind to receive a solution for the intended purpose (use vba to change shortcut menu bar on options > current database), could be helpful to this or another project :p
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:02
Joined
Oct 29, 2018
Messages
14,095
HiTechCoach,
If I understood right, in that aproach each form would have its own shortcut menu (or the same menu replicated on all forms), I was looking for a more general setting that would apply to all forms thats why I were trying through current database settings (and would still be a good way for a simple and non-specific shortcut menu to all forms). Yet, I could try your aproach but with some "global" code and call it from each form since I have like huh 7/8 forms.

Thank you both for your replies, will feedback when I get time to implement that (might take some time to answer).

On a side note: still wouldnt mind to receive a solution for the intended purpose (use vba to change shortcut menu bar on options > current database), could be helpful to this or another project :p
Hi. Without being able to do any testing right now, I suspect you were correct in having to use CurrentDb.Properties. However, if you're getting an error, it might mean the property doesn't exist yet. If so, you'll have to trap the error and create it first before assigning a value to it. In addition, one other thing I was thinking about is after you change the property using code, you may have to restart the DB before you can see the property change to take effect. Just my 2 cents...
 

HiTechCoach

Well-known member
Local time
Today, 16:02
Joined
Mar 6, 2006
Messages
4,346
I agree that if you want to do a global shortcut menu, then set at the application level would be the best for you.

FWIW: I have not found setting a global shortcut menu useful. By building it dynamically, it can be context related. Making it extremely useful to the user.
 

hugomadail

Registered User.
Local time
Today, 22:02
Joined
Aug 31, 2018
Messages
25
Hi, finally got some time to come here and feedback:
I chose to follow HiTechCoach suggestion, as dynamic shortcut menus were easier for me to apply on my database, CurrentDb.Properties is yet a bit outside my knowlegde and couldnt implement that way even after some (huge) search.
So yeah, I made a custom shortcut menu bar (right click) for my forms, might even do a different one for reports too.

Thank you both for your time on helping me.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 14:02
Joined
Oct 29, 2018
Messages
14,095
Hi, finally got some time to come here and feedback:
I chose to follow HiTechCoach suggestion, as dynamic shortcut menus were easier for me to apply on my database, CurrentDb.Properties is yet a bit outside my knowlegde and couldnt implement that way even after some (huge) search.
So yeah, I made a custom shortcut menu bar (right click) for my forms, might even do a different one for reports too.

Thank you both for your time on helping me.
Hi. Congratulations! Glad to hear you got it sorted out. Good luck with your project.
 

HiTechCoach

Well-known member
Local time
Today, 16:02
Joined
Mar 6, 2006
Messages
4,346
Great job getting is working to meet your needs. (y)

Thanks for the update and sharing your solution so others can also benefit.
 

Users who are viewing this thread

Top Bottom