Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hide forms detail in VBA

Status
Not open for further replies.

thdb

Programmer
Jul 6, 2007
1
NL
Hello,
I want to change the visibility of the details from a form. I know I can change this in the property sheet but I want to do this in VBA code when a record is selected. Almost the same as the use of Me![variable].visible=false but now for the whole detail page.
Can anyone please help me?

Thom.
 
I just tested some code behind a command button to toggle the visibility of the detail section. The command button is located in the Form Header section so it can be seen and clicked.

Code:
Private Sub cmdShowHide_Click()
    If Me.cmdShowHide.Caption = "Hide" Then
        Me.Section(0).Visible = False
        Me.cmdShowHide.Caption = "Show"
     Else
        Me.Section(0).Visible = True
        Me.cmdShowHide.Caption = "Hide"
    End If

End Sub

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Why have detail if you're only going to hide it?

Do you really want to toggle the display off and on? Or what?

You can set the visilbilty for each control as in your example (or for an entire subform which is just another control).

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top