Trying to use Macro to Hide Subform on Chkbox value

Hello all I am trying to learn how to hide/show a subform bases on the value of a checkbox… I don’t know much about coding but trying to learn. Can anyone point me to any resources that could explain how to adapt this code i found for access to work with OOo Base. Currently I have this code attached to the item status change for the chkbox control

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.SubFormBarrels.Visible = True
Else
    Me.SubFormBarrels.Visible = False
End If

End Sub

Thank You
K

This code work:

Sub chk_show_subform_change(event)
	form = event.Source.Model.Parent
	show = CBool(event.Source.State)
	dp = form.Parent.Parent.DrawPage
	subform = dp.getByindex(0)
	subform.Visible = show
End Sub

CAUTION: you should be that Subform is really control with index 0 in draw page.

image description

hide_subform.odb

Thank you Mauricio… Now I just have to learn to write my own macros…