|
-
Oct 20th, 2005, 11:01 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Hide/Unhide Access Subform
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?
-
Oct 20th, 2005, 11:10 AM
#2
Re: Hide/Unhide Access Subform
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
Declan
Don't forget to mark your Thread as resolved.
Take a moment to rate posts that you think are helpful 
-
Oct 20th, 2005, 11:50 AM
#3
Thread Starter
Hyperactive Member
Re: Hide/Unhide Access Subform
Thanks! Worked perfectly!
-
Jun 10th, 2017, 12:58 AM
#4
Registered User
Re: Hide/Unhide Access Subform
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
-
Jun 10th, 2017, 01:00 AM
#5
Registered User
Re: [RESOLVED] Hide/Unhide Access Subform
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
-
Jun 10th, 2017, 08:07 AM
#6
Re: [RESOLVED] Hide/Unhide Access Subform
i have no idea what is not working correctly, but you can try like
Code:
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
you probably need to post more information about what is not working correctly
also you should have started a new thread, not have resurrected a thread more than 10 years old
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|