Results 1 to 3 of 3
  1. #1
    MTM is offline Novice
    Windows 10 Office 365
    Join Date
    Apr 2020
    Posts
    20

    Find all nested forms on mainform


    I need to record all control captions on a many main forms with nested forms. If I can obtain the form names of the nested forms I know how to access the controls of each form. e.g. Forms!Form1!Form2!Form3.Controls, where each of these Forms is nested. Form1 is main.

    when I try:

    Private Sub Command10_Click()
    For Each Control In Me.Controls
    Debug.Print Control.Name
    If Control.ControlType = acSubform Then ' Find subforms on mainform
    Debug.Print Control.Name
    End If
    Next
    End Sub

    Debug.print shows controls and only lists Form2, but not Form3

    Is there a way to use vba to get the ALL the form names nested within Form1?

    Thank you

    Mike

  2. #2
    Gicu's Avatar
    Gicu is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,114
    Look up recursive loop in Google:
    https://www.vitoshacademy.com/vba-ne...ith-recursion/

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Nested forms with Tab Controls
    By MTM in forum Forms
    Replies: 8
    Last Post: 06-03-2020, 04:17 PM
  2. Find and replace in forms
    By Breath of Fresh Air in forum Access
    Replies: 1
    Last Post: 05-27-2020, 02:10 AM
  3. Web based forms and find record
    By haywam59 in forum Forms
    Replies: 3
    Last Post: 04-07-2016, 01:36 PM
  4. Find Button in Forms
    By bagos in forum Programming
    Replies: 3
    Last Post: 07-25-2014, 10:23 AM
  5. Replies: 3
    Last Post: 01-20-2013, 01:14 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums