Shrinking the Details section

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I want to produce a printout (Report) that contains, amongst several other
things, a person's name and up to 3 phone numbers. But rather than having
the numbers alongside each other I want them stacked. So for each record the
first line contains a work cellphone number. That will be the minimum
offering. In some cases there will also be a personal cellphone number
and/or another contact number. One, either, both or neither of the two
additional phone numbers may be present.

I want the detail section to shrink and grow depending on the existence of
data in these two controls. I can detect their content using the IsNull()
function in the Detail's On Format event procedure and make invisible the
control(s) and label(s) appropriately. But the mere existence of the
'stacked' controls prevents the report from closing up the Details section.

I've started writing some code to move the controls up to the top of the
Detail section when they're empty, followed by Me!Section!Height =
AnnoyingTwipValue to close the gap. A few If statements will probably cover
all eventualities but the resultant code promises to have all the elegance
of a sledgehammer.

Is there a better way?

TIA
Terry
 
Terry said:
I want to produce a printout (Report) that contains, amongst several other
things, a person's name and up to 3 phone numbers. But rather than having
the numbers alongside each other I want them stacked. So for each record the
first line contains a work cellphone number. That will be the minimum
offering. In some cases there will also be a personal cellphone number
and/or another contact number. One, either, both or neither of the two
additional phone numbers may be present.

I want the detail section to shrink and grow depending on the existence of
data in these two controls. I can detect their content using the IsNull()
function in the Detail's On Format event procedure and make invisible the
control(s) and label(s) appropriately. But the mere existence of the
'stacked' controls prevents the report from closing up the Details section.

I've started writing some code to move the controls up to the top of the
Detail section when they're empty, followed by Me!Section!Height =
AnnoyingTwipValue to close the gap. A few If statements will probably cover
all eventualities but the resultant code promises to have all the elegance
of a sledgehammer.

Is there a better way?

How about displaying the phone numbers in a single control and let the
control expand if necessary? Maybe something like:

([phone1]+Chr(13)+Chr(10)) & ([phone2]+Chr$(13)+Chr(10)) ...

The "+" operator propagates nulls. The above expression should eliminate
extra lines - anything inside a set of parentheses that includes a null
value gets converted to Null.
 
I've started writing some code to move the controls up to the top of the
Detail section when they're empty, followed by Me!Section!Height =
AnnoyingTwipValue to close the gap. A few If statements will probably cover
all eventualities but the resultant code promises to have all the elegance
of a sledgehammer.

Is there a better way?

How about displaying the phone numbers in a single control and let the
control expand if necessary? Maybe something like:

([phone1]+Chr(13)+Chr(10)) & ([phone2]+Chr$(13)+Chr(10)) ...

The "+" operator propagates nulls. The above expression should eliminate
extra lines - anything inside a set of parentheses that includes a null
value gets converted to Null.

Now that...
.... is elegant.

Thank you very much :)
and thanks for the explanation of the code

Terry
 
Terry said:
I've started writing some code to move the controls up to the top of the
Detail section when they're empty, followed by Me!Section!Height =
AnnoyingTwipValue to close the gap. A few If statements will probably cover
all eventualities but the resultant code promises to have all the elegance
of a sledgehammer.

Is there a better way?

How about displaying the phone numbers in a single control and let the
control expand if necessary? Maybe something like:

([phone1]+Chr(13)+Chr(10)) & ([phone2]+Chr$(13)+Chr(10)) ...

The "+" operator propagates nulls. The above expression should eliminate
extra lines - anything inside a set of parentheses that includes a null
value gets converted to Null.

Now that...
... is elegant.

Thank you very much :)
and thanks for the explanation of the code

Terry

No problem. Always willing to help out where I can.
 
Back
Top