GoToControl of a button in another form

Posted on 2005-04-28
Last Modified: 2006-11-18
I have a Pop Up form where I would like to have a command button that performs a SendKey function to put the control on a command button on the MAIN FORM.

I tried              "DoCmdGoToControl "forms!Main!button"   that didnt work

Can this be done???
Question by:jfilmore33
    LVL 16

    Expert Comment

    by:Chuck Wood
    Try this:


    (This may not work if you have a modal form that will not allow the focus to be placed anywhere but itself.)

    LVL 11

    Expert Comment

    If you are attempting to execute the command button on the Main form, then you will have to expose the command button's click event (change from private sub to public sub).
    Next, in your pop-up form code, call the event, Forms("Main").Command0_Click.

    Author Comment

    So, i changed the Private to Public, but what code do I use in the pop ups OnCLick Event to to perform the Main forms Action???
    LVL 11

    Accepted Solution

    If you are looking to kick off the Main form's command button event, then
       Forms("Main").Command0_Click     ' where Command0_Click is the command button's click event.

    It's no different than calling a public function in a global module.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Join & Write a Comment

    This article is a continuation or rather an extension from Cascading Combos ( and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
    In the article entitled Working with Objects – Part 1 (, you learned the basics of working with objects, properties, methods, and events. In Work…
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now