Hi All,
I have 2 main forms with the same subforms (the main forms specify context of the subforms, and are mutually exclusive). Up until now the fact I had 2 main forms weren't an issue since any programming I have done was within the same form, i.e. using "Me.____".
I now have a situation where I am in a 2nd level subform that needs to change the properties of another subform so that I no longer can use "Me.____". I got the syntax to call the subform correctly, but the inherent issue is that the code will only work on the active form, and there are 2 possible forms that the code would work on.
Logically, I want to call the code to account for both scenarios, and for whichever the scenario the code isn't applicable (the form that is not open), then Access would simply skip it. So yes, an error is expected, but I don't want to ignore it. This is the relevant part of the code:
Private Sub Form_Load()
If Me.AD_cmbContactedNP = "Yes" Then
Me.AD_cmbWhoContNP.Enabled = True
Me.AD_NoNPContactExplain.Enabled = False
Forms![4) ED Visit Current Readmission]![SubMain3 Current Readmission].Form![Sub6b_IntervenOpps].Visible = True
On Error Resume Next
Forms![4) ED Visit Current Readmission]![SubMain3 Current Readmission].Form![lblNPContacted].Visible = True
On Error Resume Next
Forms![4) Direct Readmission]![SubMain3 Current Readmission].Form![Sub6b_IntervenOpps].Visible = True
On Error Resume Next
Forms![4) Direct Current Readmission]![SubMain3 Current Readmission].Form![lblNPContacted].Visible = True
On Error Resume Next
The Red is Main Form 1, and the Blue is Main form 2. I was hoping that "On Error Resume Next" would work, but I have an error based on the order of the Code. With the Red Form being first, if I open the Red form I get no errors on loading even though the Blue form isn't opened (remember the Red and Blue are mutually exclusive). If I open the Blue form, I get an error on the code of the first Red line.
So all I want to do is be able to skip/bypass the error. Any help would be appreciated, thanks.