Results 1 to 4 of 4
  1. #1
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231

    Is Control inside Subform

    I'm trying to determine whether a control belongs to a subform (inside a tabbed page) which is inside my main form. Seems that if you set the following, none of the controls inside a subform get collected:

    For each ctl in Screen.ActiveForm.Controls



    For Each ctl In Screen.ActiveForm.Controls
    If Screen.ActiveForm.ActiveControl.ControlType = acSubform Then... this line not working.....
    Debug.Print "Active Control = " & Screen.ActiveForm.ActiveControl.Name
    End If


    If ctl.Tag = "Audit" Then
    Debug.Print "Control Name = " & ctl.Name & vbNewLine & "Control Type = " & ctl.ControlType
    End If

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The only way I know to address controls of a subform is through referencing the subform container control:

    With Me.subformname.Form
    'code
    End With
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    in the original tabbed pages the data on various tabs are not in subforms but actually a part of the main form & record source.....this was the only tabbed pages approach pre-2007 and maybe what you still have.... the data is simply view-able per tab but actually all part of the same record set.....

    but as to the 'active' controls - it is not a method I use typically and so I can't advise as to whether the non viewing controls are considered active or not - - but it would seem this is the other issue that is a candidate to resolve.

    maybe helps a little......

  4. #4
    CementCarver's Avatar
    CementCarver is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2013
    Location
    Canada
    Posts
    231
    Thanks NTC, I ended up just testing whether the subform name/controls existed. Although it didn't fix that line I logged the call on, I ended up using another bit of code:

    For Each ctl In Forms("frm_EDIT_CURRENT_FULLGROWER").Controls("GRO WER_TRACEABILITY_DATASHEET").Form.Controls

    to get past the problem.

    CC

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

Similar Threads

  1. Replies: 4
    Last Post: 10-08-2012, 05:33 PM
  2. Replies: 1
    Last Post: 09-05-2012, 07:04 AM
  3. Replies: 3
    Last Post: 03-29-2012, 12:40 PM
  4. Replies: 1
    Last Post: 08-11-2011, 06:22 AM
  5. Replies: 1
    Last Post: 08-03-2009, 08:24 AM

Tags for this Thread

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