Karen Schaefer
asked on
Hide subreport if record is null, but display when not null
Looking for the best approach to hiding a subreport if for a record = null, else display the record.
I mean I want the titles hidden if the record = Null.
thanks,
karen
I mean I want the titles hidden if the record = Null.
thanks,
karen
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Private Sub Report_Current()
If [rptDBAQuestionsSub].HasDa ta = 0 Then
Me.lblOutQuestion.Visible = False
Me.lblSuggestion.Visible = False
End If
End Sub
this is not working. where is the best place to place the code?
K
If [rptDBAQuestionsSub].HasDa
Me.lblOutQuestion.Visible = False
Me.lblSuggestion.Visible = False
End If
End Sub
this is not working. where is the best place to place the code?
K
what?
did you read my first post?
ASKER
ok I tried it on the no Data event still not return the results I am expecting.
Private Sub Report_NoData(Cancel As Integer)
If [rptDBAQuestionsSub].HasData = 0 Then
Me.rptDBAQuestionsSub.Visible = False
Me.lblOutQuestion.Visible = False
Me.lblResponder.Visible = False
Me.lblSuggestion.Visible = False
Else
Me.rptDBAQuestionsSub.Visible = True
Me.lblOutQuestion.Visible = True
Me.lblResponder.Visible = True
Me.lblSuggestion.Visible = True
End If
End Sub
need to see the report..
ASKER
pick this up in the a.m. thanks for the input. do you want the actual report or is the attached screen shot sufficient?
Thanks
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Graham,
Thanks for the suggestion, however, having issue with the criteria for the Detail_Format
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [rptDBAQuestionsSub].HasDa ta = 0 Then
Me.rptDBAQuestionsSub.Visi ble = False
Me.rptDBAQuestionsSub.CanS hrink = True
' Me.lblOutQuestion.Visible = False
' Me.lblResponder.Visible = False
' Me.lblSuggestion.Visible = False
' Me.lblDateCreated.Visible = False
Else
Me.rptDBAQuestionsSub.CanS hrink = False
Me.rptDBAQuestionsSub.Visi ble = True
' Me.lblOutQuestion.Visible = True
' Me.lblResponder.Visible = True
' Me.lblSuggestion.Visible = True
' Me.lblDateCreated.Visible = True
End If
If [rptUseCaseSub].HasData = 0 Then
Me.rptUseCaseSub.CanShrink = False
Else
Me.rptUseCaseSub.CanShrink = True
End If
End Sub
Thanks for the suggestion, however, having issue with the criteria for the Detail_Format
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [rptDBAQuestionsSub].HasDa
Me.rptDBAQuestionsSub.Visi
Me.rptDBAQuestionsSub.CanS
' Me.lblOutQuestion.Visible = False
' Me.lblResponder.Visible = False
' Me.lblSuggestion.Visible = False
' Me.lblDateCreated.Visible = False
Else
Me.rptDBAQuestionsSub.CanS
Me.rptDBAQuestionsSub.Visi
' Me.lblOutQuestion.Visible = True
' Me.lblResponder.Visible = True
' Me.lblSuggestion.Visible = True
' Me.lblDateCreated.Visible = True
End If
If [rptUseCaseSub].HasData = 0 Then
Me.rptUseCaseSub.CanShrink
Else
Me.rptUseCaseSub.CanShrink
End If
End Sub
ASKER
It does not like the hasdata portion of the code.
you can only use the "hasdata" in the main report event i mentioned above.
You could perhaps make the entire subreport control invisible if certain criteria are met. But we really need to examine the report in a database to see what is going on.
<But we really need to examine the report in a database to see what is going on. > I already ask about that report... :-(
ASKER
thanks Graham & Rey.
I got it to work, thanks for the input
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Reports![rptRequirementMai n]![rptDBA QuestionsS ub].Report .HasData = 0 Then
Reports![rptRequirementMai n]![rptDBA QuestionsS ub].Report .Visible = False
Else
Reports![rptRequirementMai n]![rptDBA QuestionsS ub].Report .Visible = True
End If
If Reports![rptRequirementMai n]![rptUse CaseSub].R eport.HasD ata = 0 Then
Reports![rptRequirementMai n]![rptUse CaseSub].R eport.Visi ble = False
Else
Reports![rptRequirementMai n]![rptUse CaseSub].R eport.Visi ble = True
End If
If Me.Duplicate_Req = True Or Me.Active = False Then
Me.lblOpsolete.Visible = True
Reports![rptRequirementMai n]![rptUse CaseSub].R eport.Visi ble = False
Reports![rptRequirementMai n]![rptDBA QuestionsS ub].Report .Visible = False
Else
Me.lblOpsolete.Visible = False
Reports![rptRequirementMai n]![rptUse CaseSub].R eport.Visi ble = True
Reports![rptRequirementMai n]![rptDBA QuestionsS ub].Report .Visible = True
End If
End Sub
I got it to work, thanks for the input
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Reports![rptRequirementMai
Reports![rptRequirementMai
Else
Reports![rptRequirementMai
End If
If Reports![rptRequirementMai
Reports![rptRequirementMai
Else
Reports![rptRequirementMai
End If
If Me.Duplicate_Req = True Or Me.Active = False Then
Me.lblOpsolete.Visible = True
Reports![rptRequirementMai
Reports![rptRequirementMai
Else
Me.lblOpsolete.Visible = False
Reports![rptRequirementMai
Reports![rptRequirementMai
End If
End Sub
ASKER