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 ?
sadoiroAsked:
Who is Participating?
 
mbizupConnect With a Mentor Commented:
Forms!frmInventAssign![sfInventAsgn].Form.[chkDploy].Visible = True
                                                          ^----- You need "Form" here
0
 
Leigh PurvisConnect With a Mentor Database 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
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.