Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modify a subform from another subform with VBA 1

Status
Not open for further replies.

metaltree

Technical User
Nov 27, 2006
28
CA
I have a menu form (form1) and 2 subforms (subform1 & 2).

When I update data in subform1, I want to disable subform2.

I tried from subform1

Code:
Private Sub field1_AfterUpdate()
Forms![subform2].Disable
End Sub
but VBA keeps telling me that he is unable to find that name.

Any ideas?
 
Please, ignore my last piece of code, here is the right one (that doesn't work):

From subform1
Code:
Private Sub field1_AfterUpdate()
Forms![subform2].Enabled = False
End Sub
Where subform2 stands for the name of the form (source object in properties)


However, the following code works:

From form1
Code:
Private Sub button1_Click()
...
Me![subform2].Enabled = False
End Sub
Where subform2 stands for the name of the subform (name in properties)


How to disable subform2 from subform1?
 
or you could use the following:
Code:
[blue]   Me.Parent![[purple][B][I]subForm2Name[/I][/B][/purple]].Enabled = False[/blue]
Here Parent refers to the Mainform . . .

Calvin.gif
See Ya! . . . . . .

Be sure to see thread181-473997
Also faq181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top