Right click menu - shortcut menu - edit existing item - possible? (1 Viewer)

essaytee

Need a good one-liner.
Local time
Today, 18:48
Joined
Oct 20, 2008
Messages
512
(Access 2010 - 32 bit)
Is it possible to edit and save a button item within a user-defined shortcut menu (right-click popup menu)? I'm suspecting at this juncture that it's not and the only option is to Delete the shortcut menu and recreate.

An item on a right-click menu is "User Form (show always)" and I want to change the State of it. When true there is a 'tick' and when false there's not.

Below is sample code that I thought would work but I can't find a 'Save' or 'Update' command. No error is return. The click of the button does in fact update the record within the table (done from another function).

Code:
Function rcm_ChangeState(pStrMenuName As String, pStrControlName As String, pBooState As Boolean)
On Error GoTo Error_In_Code
    
    Dim strMsg As String
    
    Dim cb As CommandBar
    Dim cbb As CommandBarButton
    
    Set cb = CommandBars(pStrMenuName)
    Set cbb = cb.Controls(pStrControlName)
    
    cbb.State = pBooState
    
    Set cbb = Nothing
    Set cb = Nothing
         
Exit_Code:
    Exit Function
    
Error_In_Code:
    strMsg = "rcm_ChangeState() - " & Err.Number & " " & Err.Description
    MsgBox strMsg, , "xxxxxx"
    Resume Exit_Code
        
End Function

The above code does not change the state of the menu button item.

Any sugestions welcome
 

essaytee

Need a good one-liner.
Local time
Today, 18:48
Joined
Oct 20, 2008
Messages
512
I went out for the afternoon, returned, re-checked things and wouldn't you know, with fresh eyes, I could see in a function that is called before this function, was not returning true, always false. Corrected that and all works. That is, the passed in parameter, pBooState, is correctly set.

Now on the right-click menu a 'tick' correctly appears, when true.
 

Users who are viewing this thread

Top Bottom