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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hide detail using sub

Status
Not open for further replies.

abdhab

MIS
Dec 10, 2006
51
0
0
CA
i am trying to hide a detail record using the following sub

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (Me.name = ".") Then
Me.Detail.Visible = False
Else
Me.Detail.Visible = True
End If
End Sub

but it is not working, i always get all the detail records as if there is no sub.. is there anything wrong with my code?
 
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If (name = ".") Then
Me.Detail.Visible = False
Else
Me.Detail.Visible = True
End If
End Sub
 
This will never work since "Name" will return the name of the form. Name is a bad name for field or anything else in Access since everything has a Name property. Change name to something like EmployeeName and use code like:
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Cancel = (Me.EmployeeName = ".")
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top