I have a subform on a form that I want to be hidden when the form loads and when the user clicks a command button to unhide.
Whats the best way to do this?
Printable View
I have a subform on a form that I want to be hidden when the form loads and when the user clicks a command button to unhide.
Whats the best way to do this?
In the _Load event of the main form set the Visible property of the subform to False, then in the _Click event of the CommandButton set the Visible property to True.
Heres an example from one of my apps with a Subform called "QUOTE_DETAIL_ADD".
VB Code:
Private Sub Form_Load() Me.txtQUOTE_DATE = Now() Me.QUOTE_DETAIL_ADD.Visible = False End Sub Private Sub btnAddQuote_Click() Me.QUOTE_DETAIL_ADD.Visible = True Me.QUOTE_DETAIL_ADD.SetFocus End Sub
Thanks! Worked perfectly!
Pls help me i am in trouble
this code not work properly
Private Sub Active_AfterUpdate()
'After Update of checkbox1
'Check if Active checkbox1 is selected
'then show or hide subform
If Me.Active = True Then
Me.sub_form.Visible = True
Else
Me.sub_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.sub_form.Visible = True
Else
Me.sub_form.Visible = False
End If
End Sub
Private Sub sub_form_Enter()
End Sub
not work properly
Private Sub Active_AfterUpdate()
'After Update of checkbox1 ..........................ckeckbox name
'Check if Active checkbox1 is selected
'then show or hide subform
If Me.Active = True Then
Me.sub_form.Visible = True.............subform name
Else
Me.sub_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.sub_form.Visible = True
Else
Me.sub_form.Visible = False
End If
End Sub
Private Sub sub_form_Enter()
End Sub
i have no idea what is not working correctly, but you can try like
you probably need to post more information about what is not working correctlyCode:Private Sub Active_AfterUpdate()
'After Update of checkbox1 ..........................ckeckbox name
'Check if Active checkbox1 is selected
'then show or hide subform
Me.sub_form.Visible = Me.Active
End Sub
also you should have started a new thread, not have resurrected a thread more than 10 years old