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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Learning Code

Status
Not open for further replies.

puforee

Technical User
Oct 6, 2006
741
US
I have a Form that has a Sub-Form. That Sub-Form has several Sub-Forms of its own. I want the setting of a control on the Form to decide if the Sub-Form is enabled. And if it is, which of it's Sub-Forms are enabled. Here is what I have been working on.

Private Sub Form_Current()
If Me.Status = 1 Then
Me.Accesses_Subform.Enabled = True
Employee.[Form_Employee Code Frm].Form![Accesses Subform].Form![APC Subform].Enabled = True
Else: Me.Accesses_Subform.Enabled = False
End If
End Sub


I think I got the first two statements right. I check Status to see if it is a 1. If it is I enable the Accesses_Subform.

But, I also want to Enable the APC Sub-form that is on the Accesses Sub-Form. I don't think this code is correct. There are more items to add to the Then and the Else statements but I need help with the syntax when talking about a Sub-Form on a Sub-Form on a Form.

I hope you can understand my giberish...I am trying to stop using Macros and learn code.

Thanks,
 
TheAceMan1,

I removed everything from the main form. I created a brand new Sub for....and called it Accesses Subform1. I then opened the Main form and using the Insert SubForm tool insterted the Accesses Subform1. I adjusted the Load, Unloade, and OnCurrent events to reflect Accesses Subform1.

I did not add any other subforms. I figured it we can get one working we should be able to do the others.

I get the same failures. It fails at Accesses.Visable = True.

Just an update.
 
PHV,

Sorry about the spelling problem. Be assured, it was only on the posting and not in the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top