Show/Hide Detail section by code

L

lj

Access 2003 on WinXP Pro

I have a report of SalesAreas in which we have had cancellation of our
service. Each cancellation has an ID (CancID). When, after a suitable
period of time, we call back on this person to see if he would like to
restart service, that follow-up call has a foreign key of the CancID.

Currently I have the report set up so SalesAreaID is the first group header;
then a group header for CancID, then FollowUp call information is in the
detail section because for each CancID there can be several follow up
attempts.

However, most of the CancID records do not as yet have follow ups. But as it
prints now, there is a blank line between each cancellation (the empty
Detail area).

If I set Detail.visible to false, it eliminates the blank line. How do I
tell it to be visible if there IS follow up information?

My thought was to code an If...Then statement but I don't know exactly how
to word it.

I want it to say:

If [Detail has records] Then
Detail.Visible = True
Else
Detail.Visible = False
End If

.... but I don't what expression to use for [Detail has records] or [Detail
isn't empty]... (I tried doing it the other way around with IsNull(Detail)
That didn't seem to work; maybe I messed up the syntax somehow...)

Also, I have the CanGrow and CanShrink values set to Yes because some
records might have a wordy memo field. That part works just fine.

Hope this makes sense?

Any help would be appreciated.

lj
 
L

Larry Linson

Try, instead, using the CanShrink properties of both the Controls which
display the information and for the Detail Section itself. That should allow
it to shrink away to nothing if there is no data.

Larry Linson
Microsoft Access MVP
 
L

lj

I tried that; it did not seem to work. Any other suggestions? So far the
only thing that makes the empty Detail section disappear is the .visible
property. I just can't figure out how to have it be visible for the records
in which there is information...

Thanks for your help,
lj


Larry Linson said:
Try, instead, using the CanShrink properties of both the Controls which
display the information and for the Detail Section itself. That should allow
it to shrink away to nothing if there is no data.

Larry Linson
Microsoft Access MVP

lj said:
Access 2003 on WinXP Pro

I have a report of SalesAreas in which we have had cancellation of our
service. Each cancellation has an ID (CancID). When, after a suitable
period of time, we call back on this person to see if he would like to
restart service, that follow-up call has a foreign key of the CancID.

Currently I have the report set up so SalesAreaID is the first group header;
then a group header for CancID, then FollowUp call information is in the
detail section because for each CancID there can be several follow up
attempts.

However, most of the CancID records do not as yet have follow ups. But
as
it
prints now, there is a blank line between each cancellation (the empty
Detail area).

If I set Detail.visible to false, it eliminates the blank line. How do I
tell it to be visible if there IS follow up information?

My thought was to code an If...Then statement but I don't know exactly how
to word it.

I want it to say:

If [Detail has records] Then
Detail.Visible = True
Else
Detail.Visible = False
End If

... but I don't what expression to use for [Detail has records] or [Detail
isn't empty]... (I tried doing it the other way around with IsNull(Detail)
That didn't seem to work; maybe I messed up the syntax somehow...)

Also, I have the CanGrow and CanShrink values set to Yes because some
records might have a wordy memo field. That part works just fine.

Hope this makes sense?

Any help would be appreciated.

lj
 
L

Larry Linson

Read carefully the Help on CanShrink. It is possible to have the data and a
Form/Report designed/constructed so that it will not, in fact, Shrink.
CanShrink definitely does work, done properly.

Larry Linson
Microsoft Access MVP

lj said:
I tried that; it did not seem to work. Any other suggestions? So far the
only thing that makes the empty Detail section disappear is the .visible
property. I just can't figure out how to have it be visible for the records
in which there is information...

Thanks for your help,
lj


Larry Linson said:
Try, instead, using the CanShrink properties of both the Controls which
display the information and for the Detail Section itself. That should allow
it to shrink away to nothing if there is no data.

Larry Linson
Microsoft Access MVP

lj said:
Access 2003 on WinXP Pro

I have a report of SalesAreas in which we have had cancellation of our
service. Each cancellation has an ID (CancID). When, after a suitable
period of time, we call back on this person to see if he would like to
restart service, that follow-up call has a foreign key of the CancID.

Currently I have the report set up so SalesAreaID is the first group header;
then a group header for CancID, then FollowUp call information is in the
detail section because for each CancID there can be several follow up
attempts.

However, most of the CancID records do not as yet have follow ups. But
as
it
prints now, there is a blank line between each cancellation (the empty
Detail area).

If I set Detail.visible to false, it eliminates the blank line. How do I
tell it to be visible if there IS follow up information?

My thought was to code an If...Then statement but I don't know exactly how
to word it.

I want it to say:

If [Detail has records] Then
Detail.Visible = True
Else
Detail.Visible = False
End If

... but I don't what expression to use for [Detail has records] or [Detail
isn't empty]... (I tried doing it the other way around with IsNull(Detail)
That didn't seem to work; maybe I messed up the syntax somehow...)

Also, I have the CanGrow and CanShrink values set to Yes because some
records might have a wordy memo field. That part works just fine.

Hope this makes sense?

Any help would be appreciated.

lj
 
L

lj

Larry,

Thanks for your help. I will look more closely at the Help info. I ended up
using a subreport but would certainly like to understand how to get the
CanShrink to work. (I saved the rejected version of the form just in case
someone came through with a solution.)

Thanks again for all of the help you and other MVPs supply. This newsgroup
has taught me so much.

lj


Larry Linson said:
Read carefully the Help on CanShrink. It is possible to have the data and a
Form/Report designed/constructed so that it will not, in fact, Shrink.
CanShrink definitely does work, done properly.

Larry Linson
Microsoft Access MVP

lj said:
I tried that; it did not seem to work. Any other suggestions? So far the
only thing that makes the empty Detail section disappear is the .visible
property. I just can't figure out how to have it be visible for the records
in which there is information...

Thanks for your help,
lj


But
as
do
I
tell it to be visible if there IS follow up information?

My thought was to code an If...Then statement but I don't know
exactly
how
to word it.

I want it to say:

If [Detail has records] Then
Detail.Visible = True
Else
Detail.Visible = False
End If

... but I don't what expression to use for [Detail has records] or [Detail
isn't empty]... (I tried doing it the other way around with IsNull(Detail)
That didn't seem to work; maybe I messed up the syntax somehow...)

Also, I have the CanGrow and CanShrink values set to Yes because some
records might have a wordy memo field. That part works just fine.

Hope this makes sense?

Any help would be appreciated.

lj
 

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