Referencing Subform Control property from Main Form

Posted on 2006-05-04
Last Modified: 2006-11-18
I have a combo box (cboWellID) on a Main Form (frmInventAssign) with an AfterUpdate Event:

Private Sub cboWellID_AfterUpdate()
If Me!txtQty = 0 Then
Me!cboWellID = Null
GoTo Exit_cboWellID_AfterUpdate
Forms!frmInventAssign![sfInventAsgn].[chkDploy].Visible = True
End If

    Exit Sub

End Sub

This is meant to insure that the user has indicated a Quantity to withdraw from inventory and a Well to which it is assigned before the checkbox ("chkDploy"; Visible = No) control on a subform (sfInventAsgn) becomes visible.

When the code executes it fails with this error message:

Run-time Error 438

Object doesn’t support this property or method

How should I refer to the control ?
Question by:sadoiro
    LVL 61

    Accepted Solution

    Forms!frmInventAssign![sfInventAsgn].Form.[chkDploy].Visible = True
                                                              ^----- You need "Form" here
    LVL 44

    Assisted Solution

    by:Leigh Purvis

    Forms!frmInventAssign![sfInventAsgn].Form![chkDploy].Visible = True
    or just
    Me![sfInventAsgn].Form![chkDploy].Visible = True
    LVL 44

    Expert Comment

    by:Leigh Purvis
    Ahh Science in action.
    Through empirical evidence we can hypothesize that looking up a web link takes 1 minute.
    LVL 61

    Expert Comment

    You're quick.  It took me much longer.  Here's another one:
    LVL 44

    Expert Comment

    by:Leigh Purvis
    Well, I knew where to look - but had to scroll past the 30 above it ;-)

    Author Comment

    Thanks for the help. I had used the ".Form." on a previous iteration and received a different error message, but in solving the cause for that one I created an oops by leaving it out later. I appreciate it.
    LVL 61

    Expert Comment

    Glad to help!

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
    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.

    730 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

    15 Experts available now in Live!

    Get 1:1 Help Now