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

Referencing Subform Control property from Main Form

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!txtQty.SetFocus
Me!cboWellID = Null
GoTo Exit_cboWellID_AfterUpdate
Else
Forms!frmInventAssign![sfInventAsgn].[chkDploy].Visible = True
End If

Exit_cboWellID_AfterUpdate:
    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 ?
0
sadoiro
Asked:
sadoiro
  • 3
  • 3
2 Solutions
 
mbizupCommented:
Forms!frmInventAssign![sfInventAsgn].Form.[chkDploy].Visible = True
                                                          ^----- You need "Form" here
0
 
Leigh PurvisDatabase DeveloperCommented:
http://www.mvps.org/access/forms/frm0031.htm

Forms!frmInventAssign![sfInventAsgn].Form![chkDploy].Visible = True
or just
Me![sfInventAsgn].Form![chkDploy].Visible = True
0
 
Leigh PurvisDatabase DeveloperCommented:
Ahh Science in action.
Through empirical evidence we can hypothesize that looking up a web link takes 1 minute.
:-D
0
NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

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

http://support.microsoft.com/kb/q113352/
0
 
Leigh PurvisDatabase DeveloperCommented:
Well, I knew where to look - but had to scroll past the 30 above it ;-)
0
 
sadoiroAuthor Commented:
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.
0
 
mbizupCommented:
Glad to help!
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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