Access - Tabbed Form - Hide one of the Subforms on a tab

Posted on 2012-09-10
Last Modified: 2012-09-11
Hello all
I have a tabbed Form with 8 tabs.  Each tab contains a subform.  This particular subform is itself comprised of two subforms.  For one of my uses I want to Hide or make not visible one of the subform's subform.  Can that be done?  

The particular sub/subform I want to hide is on tabbed form Page5,  the ControlName of the subform is [MachinePullCashCount]

the sub of that subform I want to make not visible is

In my Private Sub that part of the code was:

Application.Echo False
Forms![frm_DataReporting]![MachinePullCashCount].Controls("ShiftRprgEndCountDetails_Coins").Visible = False
Application.Echo True

Open in new window

Since I set the Focus to Page2 and this sub/subform is on Page5 I don't understand why it fails.

I get Run-time error 2165
You can't hide a control that has the focus.

Question by:wlwebb
    LVL 5

    Expert Comment


    Author Comment

    Unfortunately No..... Doesn't explain "hiding" a Subform's Subform.
    LVL 74

    Expert Comment

    by:Jeffrey Coachman
    Too complex IMHO.

    Can you post a sample of this "recursive" form, ...following these steps:

    Sample database notes:
    1. Back up your database(s).
    2. Combine the front and back ends into one database file.
    3. Remove any startup options, unless they are relevant to the issue.
    4. Remove any records unless they are relevant to the issue.
    5. Delete any objects that do not relate directly to the issue.
    6. Remove any references to any "linked" files (files outside of the database, Images, OLE Files, ...etc)
    7. Remove any references to any third party Active-x Controls (unless they are relevant to the issue)
    8. Remove, obfuscate, encrypt, or otherwise disguise, any sensitive data.
    9. Compile the code. (From the VBA code window, click: Debug-->Compile)
    10. Run the compact/Repair utility.
    11. Remove any Passwords and/or security.
    12. If a form is involved in the issue, set the Modal and Popup properties to: No
        (Again, unless these properties are associated with the issue)
    13. Post the explicit steps to replicate the issue.
    14. Test the database before posting.

    In other words, a database that we can easily open and immediately see and/or troubleshoot the issue.
    And if applicable, also include a clear graphical representation of the *Exact* results you are expecting, based on the sample data.  

    LVL 119

    Accepted Solution

    try changing this line

    Forms![frm_DataReporting]![MachinePullCashCount].Controls("ShiftRprgEndCountDetails_Coins").Visible = False


    Forms![frm_DataReporting]![MachinePullCashCount].Form![ShiftRprgEndCountDetails_Coins].Visible = False

    Author Closing Comment

    Thank you cap1.  Jeff I hear you and understand... I had posted various questions over a short period of time ( I know you hadn't responded so you probably were out of the loop on most of it)  so my assumption was most of it was repetitive as far as explaination.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    761 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

    10 Experts available now in Live!

    Get 1:1 Help Now