Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 579
  • Last Modified:

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

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.

1 Solution
wlwebbAuthor Commented:
Unfortunately No..... Doesn't explain "hiding" a Subform's Subform.
Jeffrey CoachmanMIS LiasonCommented:
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, ...post 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.  

Rey Obrero (Capricorn1)Commented:
try changing this line

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


Forms![frm_DataReporting]![MachinePullCashCount].Form![ShiftRprgEndCountDetails_Coins].Visible = False
wlwebbAuthor Commented:
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.

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now