Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7630527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:07:41+00:00 2026-05-31T06:07:41+00:00

In an MS Access form, I have a working popup menu but I wonder

  • 0

In an MS Access form, I have a working popup menu but I wonder about ways to set it up differently.

Popup menu definition:

With CommandBars.Add("TreeNodeActions", msoBarPopup, False)
    With .Controls.Add(msoControlButton)
        .caption = "Copy"
        .OnAction = "=CopyNode()"
    End With
End With

Question 1: why are the equal sign and empty parameter list necessary (things don’t work without them)? Why not just .OnAction = "copyNode", as suggested in other threads on this forum?

Question 2: I wish to run a subroutine, but the only way to do that is to call a function that calls the subroutine – see below. How can I call the subroutine directly?

Private Function CopyNode()
    Call CopyBid
End Function

Private Sub CopyBid()
    Dim nodx As node

    Set nodx = Me.TreeView1.Nodes(Me.nodeKeySelected.Value)
    Me.BidIdToBeCopied = nodx.Tag
End Sub

Question 3: the popup menu is on a treeview control; I wish to pass the node selected to the subroutine, so that I don’t have to store the node key on the form (on a treeview mouse click) and use it in the sub above. I would like to be able to have the below. How can menu items defined in the commandbars control pass parameters?

Private Sub CopyBid(nodx As node)
    Me.BidIdToBeCopied = nodx.Tag
End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:07:42+00:00Added an answer on May 31, 2026 at 6:07 am

    Did some further researching myself. Not conclusive, but I got as far as this:
    Q1: no documentation found, it’s just a fact that the syntax in ms-access vba onAction property is like that. Still feels a little odd that no explanation can be found for this – I would have expected something like “the equal sign makes sure that the ensuing function or procedure is called. The parentheses at the end are redundant but have to be added for a parameterless functions”
    Q2: it seems this cannot be done – so reuse of existing sub is not possible, unless by changing this to a function. Strange but probably a fact of life again. No documentation found on this one either.
    Q3: passing parameters is less easy than it seems – the mandatory parentheses suggest that it is just a matter of supplying variables in the onAction spec for functions that have parameters. It’s not that simple, probably because the onAction spec is a string that triggers a search for a known function name without taking into account parameters. One way of supplying parameters that I was able to find (finally some useful information!) may be found in calling a function and passing arguments with .onaction. Feels like a dirty work around to me, so I still wonder whether neater solutions are available. And I haven’t tested this “solution” yet…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a bound form in microsoft access that allows a user to add
I have a form in Access 2003 that should only be working with a
I have a Microsoft Access Popup Form which I use to lookup addresses. Once
I have a Microsoft Access form that is bound to a linked SQL Server
Let's say I have an embedded Excel Spreadsheet on a Microsoft Access form. I
I have created application where i just need to access data form assets folder.
I have a form in MS access. I have created a few textboxs in
I have a sub form in Access: The CopyNo is a combobox that lets
We have the form from where we need to access the values through a
I have an C# form application that use an access database. This application works

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.