Multiple criteria for "Is visible" property

R

Richard G

The following is part of a report page in Access 2000

I have a text box called “txtgroupcount†with a control source of Count(*)
in Groupheader0

I also have the following in the “On Format†event for the following three
sections

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Detail.Visible = (Me.txtgroupcount > 9)
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupHeader0.Visible = (Me.txtgroupcount > 9)
End Sub

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupHeader1.Visible = (Me.txtgroupcount > 9)
End Sub

This then shows only those groups where there are 10 or more records within
Group0

In the detail section is a text box called “datedâ€

I’d like to be able to further restrict the groups shown to those where the
latest date in “dated†is no more than a month prior to today.

Is this possible please?
 
M

Marshall Barton

Richard said:
The following is part of a report page in Access 2000

I have a text box called “txtgroupcount” with a control source of Count(*)
in Groupheader0

I also have the following in the “On Format” event for the following three
sections

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Detail.Visible = (Me.txtgroupcount > 9)
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupHeader0.Visible = (Me.txtgroupcount > 9)
End Sub

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupHeader1.Visible = (Me.txtgroupcount > 9)
End Sub

This then shows only those groups where there are 10 or more records within
Group0

In the detail section is a text box called “dated”

I’d like to be able to further restrict the groups shown to those where the
latest date in “dated” is no more than a month prior to today.


Add a text box (named txtLatestDate) to the group header and
set its control source expression to:
=Max([the date field name])
Note that [the date field name] must be the name of the
field in the report's record source, not the name of a
control in the report.

You can then hide sections in the group by using:
Me.GroupHeader0.Visible = (Me.txtLatestDate >= DateAdd("m",
-1, Date))
 
R

Richard G

Thanks for the syntax
The only place I can put the second conditional visible statement is lije
this

otherwise I get errors. This way however seems to still allow the latest
date to be outside more than a month earlier. What have I done wrong please?

Thanks
Richard

Marshall Barton said:
Richard said:
The following is part of a report page in Access 2000

I have a text box called “txtgroupcount†with a control source of Count(*)
in Groupheader0

I also have the following in the “On Format†event for the following three
sections

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Detail.Visible = (Me.txtgroupcount > 9)
End Sub

Private Sub GroupHeader0_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupHeader0.Visible = (Me.txtgroupcount > 9)
End Sub

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)
Me.GroupHeader1.Visible = (Me.txtgroupcount > 9)
End Sub

This then shows only those groups where there are 10 or more records within
Group0

In the detail section is a text box called “datedâ€

I’d like to be able to further restrict the groups shown to those where the
latest date in “dated†is no more than a month prior to today.


Add a text box (named txtLatestDate) to the group header and
set its control source expression to:
=Max([the date field name])
Note that [the date field name] must be the name of the
field in the report's record source, not the name of a
control in the report.

You can then hide sections in the group by using:
Me.GroupHeader0.Visible = (Me.txtLatestDate >= DateAdd("m",
-1, Date))
 
M

Marshall Barton

Richard said:
Thanks for the syntax
The only place I can put the second conditional visible statement is lije
this


otherwise I get errors. This way however seems to still allow the latest
date to be outside more than a month earlier. What have I done wrong please?


The second statement is wiping out whatever the first one
did. You need to combine them into one statement:

Me.GroupHeader0.Visible = (Me.txtLatestDate >=
DateAdd("m",-1,DATE)) AND (Me.txtgroupcount > 9)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top