Shrink and Grow

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

I have found that using concatenated fields in a report's
underlying query can eliminate many of the formatting
issues related to text boxes growing and shrinking. The
most vexing problem is that if text boxes are arranged one
above the other, and two such pairs are side by side, if
the top text box on the right grows to accomodate an extra
line of text, the bottom text box on the left gets pushed
down.
In one particular situation I cannot quite make
concatenated fields work. I have a notes field and a
comments field. I can concatenate them with carriage
return and line feed, but when either needs more than one
line the second line is left-aligned with the label. I
want:

Notes: This is the first line of Note text
This is the second line of text
Comments: This is a comment

but I get:

Notes: This is the first line of Note text
This is the second line of text
Comments: This is a comment

I don't know where the line break, if any, will occur in
Notes.

The report is in landscape format. The left side of the
report has Name and Address, and the middle has other
info. Both are concatenated into single query fields. On
the right side of the report, If I use a text box with
label for Notes and another for Comments, and set the
Detail section's Format event to hide them if they are
empty, the problem comes when Notes (on top) is empty and
Comments contains something. In that case I would like
Comments to be top-aligned with the text boxes for the
concatenated fields (Address and Other Info). Either or
both fields could be empty for any given record.
A minor thing, I know, but I like reports to be tidy.
 
Bruce said:
I have found that using concatenated fields in a report's
underlying query can eliminate many of the formatting
issues related to text boxes growing and shrinking. The
most vexing problem is that if text boxes are arranged one
above the other, and two such pairs are side by side, if
the top text box on the right grows to accomodate an extra
line of text, the bottom text box on the left gets pushed
down.
In one particular situation I cannot quite make
concatenated fields work. I have a notes field and a
comments field. I can concatenate them with carriage
return and line feed, but when either needs more than one
line the second line is left-aligned with the label. I
want:

Notes: This is the first line of Note text
This is the second line of text
Comments: This is a comment

but I get:

Notes: This is the first line of Note text
This is the second line of text
Comments: This is a comment

I don't know where the line break, if any, will occur in
Notes.

The report is in landscape format. The left side of the
report has Name and Address, and the middle has other
info. Both are concatenated into single query fields. On
the right side of the report, If I use a text box with
label for Notes and another for Comments, and set the
Detail section's Format event to hide them if they are
empty, the problem comes when Notes (on top) is empty and
Comments contains something. In that case I would like
Comments to be top-aligned with the text boxes for the
concatenated fields (Address and Other Info). Either or
both fields could be empty for any given record.


Definitely use the text box with a label to get the
horizontal alignment you're looking for. To get the
comments to move up when notes is empty, just set the
comment's text box's and label's Top property when you check
the notes text box.

If IsNull(Me.txtNotes) Then
Me.lblNotes.Visible = False
Me.txtComments.Top = Me.txtNotes.Top
Me.lblComments.Top = Me.txtComments.Top
Else
Me.lblNotes.Visible = True
Me.txtComments.Top = .5 * 1440
Me.lblComments.Top = Me.txtComments.Top
End If
 
-----Original Message-----



Definitely use the text box with a label to get the
horizontal alignment you're looking for. To get the
comments to move up when notes is empty, just set the
comment's text box's and label's Top property when you check
the notes text box.

If IsNull(Me.txtNotes) Then
Me.lblNotes.Visible = False
Me.txtComments.Top = Me.txtNotes.Top
Me.lblComments.Top = Me.txtComments.Top
Else
Me.lblNotes.Visible = True
Me.txtComments.Top = .5 * 1440
Me.lblComments.Top = Me.txtComments.Top
End If
 
Pushed the Send button too soon on that last one.
Thanks for the help. After some experimenting I settled
on 0.18 * 1440, but I don't know what those numbers are.
Can I extend this code to a third text box (txtScope)? I
have been trying, but have made no real progress beyond
figuring out that nested If statements might work.
Also, in a concatenated field chr(13) & chr(10) puts the
lines closer together than I would like. Is there a way
to increase the spacing between lines?
As an editorial comment, report formatting is absurdly
complicated and difficult.
 
The .18 is the measurement in inches and the 1440 converts
it to twips (the units Access uses internally). Is the .18
the height of the Notes text box? If it is, then you can
use Me.txtNotes.Height instead of the .18 * 1440

Moving a third text box up under the second text box is just
more of the same:

If IsNull(Me.txtNotes) Then
Me.lblNotes.Visible = False
Me.txtComments.Top = Me.txtNotes.Top
Me.lblComments.Top = Me.txtComments.Top
Else
Me.lblNotes.Visible = True
Me.txtComments.Top = .18 * 1440
Me.lblComments.Top = Me.txtComments.Top
End If

If IsNull(Me.txtComments) Then
Me.lblComments.Visible = False
Me.txtScope.Top = Me.txtComments.Top
Me.lblScope.Top = Me.txtScope.Top
Else
Me.lblComments.Visible = True
Me.txtScope.Top = Me.txtComments.Top + .18 * 1440
Me.lblScope.Top = Me.txtScope.Top
End If

AXP has the LineSpacing property to specify the spacing of
lines in a single text box (or label). I have never used
it, so I don't know how effective it is.
 
Thanks again. I wondered if those curiously named twips
were in there somewhere. Even if I use the text box
height in this case, the conversion formula will come in
handy, I think. I see that I can accomplish what I need
by using a series of If...Then...Else statements rather
than a nested one, which is certainly easier on the brain
(mine, anyhow). Now that I know how to do this, I hope I
have a chance before long to get back to it.
-----Original Message-----
The .18 is the measurement in inches and the 1440 converts
it to twips (the units Access uses internally). Is the .18
the height of the Notes text box? If it is, then you can
use Me.txtNotes.Height instead of the .18 * 1440

Moving a third text box up under the second text box is just
more of the same:

If IsNull(Me.txtNotes) Then
Me.lblNotes.Visible = False
Me.txtComments.Top = Me.txtNotes.Top
Me.lblComments.Top = Me.txtComments.Top
Else
Me.lblNotes.Visible = True
Me.txtComments.Top = .18 * 1440
Me.lblComments.Top = Me.txtComments.Top
End If

If IsNull(Me.txtComments) Then
Me.lblComments.Visible = False
Me.txtScope.Top = Me.txtComments.Top
Me.lblScope.Top = Me.txtScope.Top
Else
Me.lblComments.Visible = True
Me.txtScope.Top = Me.txtComments.Top + .18 * 1440
Me.lblScope.Top = Me.txtScope.Top
End If

AXP has the LineSpacing property to specify the spacing of
lines in a single text box (or label). I have never used
it, so I don't know how effective it is.
--
Marsh
MVP [MS Access]



Pushed the Send button too soon on that last one.
Thanks for the help. After some experimenting I settled
on 0.18 * 1440, but I don't know what those numbers are.
Can I extend this code to a third text box (txtScope)? I
have been trying, but have made no real progress beyond
figuring out that nested If statements might work.
Also, in a concatenated field chr(13) & chr(10) puts the
lines closer together than I would like. Is there a way
to increase the spacing between lines?
As an editorial comment, report formatting is absurdly
complicated and difficult. fields.
On

.
 
Back
Top