I think you need to change the expression to check for Null values (which are
not the same as zero length string values ("").
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If Len(Me.txtMaterials & "") = 0 Then
Me.txtMaterials.Visible = False
Me.txtMatHead.Visible = False
End If
End Sub
Or
Private Sub GroupFooter0_Format(Cancel As Integer, FormatCount As Integer)
If IsNull(Me.txtMaterials) Then
Me.txtMaterials.Visible = False
Me.txtMatHead.Visible = False
End If
End Sub
That will cause you a problem because you never set the visible property to
true if Me.TxtMaterials has a value. So once the group footer set the
controls visibility to False then it will stay that way for the rest of the
report.
I might use one of the alternatives below
Me.txtMaterials.Visible = Not IsNull(Me.txtMaterials)
me.txtMatHead.Visible = Not IsNull(Me.txtMaterials)
Or use
Me.txtMaterials.Visible = Len(Me.txtMaterials & "")>0
me.txtMatHead.Visible = Len(Me.txtMaterials & "")>0
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
> I have the following code in a report's group footer:
>
[quoted text clipped - 17 lines]
>
> Keith.
Keith Wilby - 28 Apr 2008 13:06 GMT
>I think you need to change the expression to check for Null values (which
>are not the same as zero length string values ("").
<snip>
<slaps forehead>
Thanks very much John, works a treat. I don't know why I got it into my
head that I had to check for ZLS and not nulls. One of those days. Strange
how it "half" worked though.
Thanks again.
Regards,
Keith.
John Spencer - 28 Apr 2008 15:27 GMT
I'm guessing that it half-worked because you had the control's can shrink
property set to true. I could definitely be wrong though, since I obviously
have no idea how you set up the report.
John Spencer
Access MVP 2002-2005, 2007-2008
Center for Health Program Development and Management
University of Maryland Baltimore County
>> I think you need to change the expression to check for Null values
>> (which are not the same as zero length string values ("").
[quoted text clipped - 11 lines]
> Regards,
> Keith.
Keith Wilby - 28 Apr 2008 15:47 GMT
> I'm guessing that it half-worked because you had the control's can shrink
> property set to true. I could definitely be wrong though, since I
> obviously have no idea how you set up the report.
That would explain it, yes.
Many thanks John.
Evi - 28 Apr 2008 19:39 GMT
You may also need to add to your code
If Len(Me.txtMaterials & "") = 0 Then
Me.txtMaterials.Visible = False
Me.txtMatHead.Visible = False
Else
Me.txtMaterials.Visible = True
Me.txtMatHead.Visible = True
End If
I don't know about later versions, but in Acc97, if I omitted the Else, the
controls remained invisible even when later records had a value in them.
Evi
> I think you need to change the expression to check for Null values (which are
> not the same as zero length string values ("").
[quoted text clipped - 57 lines]
> >
> > Keith.