subfrom visible/ invisible controlled by checkbox

Joined
Jun 16, 2011
Messages
1
Reaction score
0
Can anyone help?

Im really struggling ( fairly new to programming access!

I want to be able to show a subform depending whether a check box on the main form is checked or not.... I found this codeusing the on current and after update controld but I keep getting a compile error can anyone help?

the subform is called "PSU subform" what am I doing wrong


Private Sub Check8_AfterUpdate()
'After Update of checkbox
'Check if Active checkbox is selected
'then show or hide subform
If Me.Active = True Then
Me.PSU SubForm.Visible = True
Else
Me.PSU SubForm.Visible = False
End If

End Sub
Private Sub Form_Current()
'On current event of main form
'Check if Active checkbox is selected
'then show or hide subform
If Me.Active = True Then
Me.PSU SubForm.Visible = True
Else
Me.PSU SubForm.Visible = False
End If
End Sub
 
Modify the Code as below:

Code:
Private Sub Check8_AfterUpdate()
'After Update of checkbox
'Check if Active checkbox is selected
'then show or hide subform
If Me.Active = True Then
Me.[PSU SubForm].Form.Visible = True
Else
Me.[PSU SubForm].Form.Visible = False
End If
 
End Sub
Private Sub Form_Current()
'On current event of main form
'Check if Active checkbox is selected
'then show or hide subform
If Me.Active = True Then
Me.[PSU SubForm].Form.Visible = True
Else
Me.[PSU SubForm].Form.Visible = False
End If
End Sub
 
Back
Top