AirCounsel
New member
- Local time
- Today, 16:46
- Joined
- May 4, 2012
- Messages
- 8
Hi, I'm new here and somewhat inexperienced with Access VBA, so any instructions will need to be as detailed as possible. I want to be able to hide or show a subform on a main form with a checkbox bound to a table field. I've used the following code in the form current event and the checkbox afterupdate event:
'On current event of main form
'Check if Active checkbox is selected
'then show or hide subform
If Me.ChkWorker = True Then
'Me.Workers_Subform.Visible = True
Else
Me.Workers_Subform.Visible = False
End If
I get mixed results. When I check and uncheck the checkbox, it works fine. However, when I closed the form and re-open, things don't work. The checkbox appears checked, but the subform is not visible until I uncheck and check it again. Same issue when I first open the database. So, If this code is correct, under which event should I place it.
Thanks!
AirCounsel
'On current event of main form
'Check if Active checkbox is selected
'then show or hide subform
If Me.ChkWorker = True Then
'Me.Workers_Subform.Visible = True
Else
Me.Workers_Subform.Visible = False
End If
I get mixed results. When I check and uncheck the checkbox, it works fine. However, when I closed the form and re-open, things don't work. The checkbox appears checked, but the subform is not visible until I uncheck and check it again. Same issue when I first open the database. So, If this code is correct, under which event should I place it.
Thanks!
AirCounsel