Shrink text box that contains an expression

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

Bruce

I have received a great deal of help from this newsgroup,
enabling me to find a way to properly format a report. I
was having trouble with one aspect of it, and I found a
solution that worked, but it will come up again, so I want
to find out as much as I can now. I needed a concatenated
value in a text box, and with Marshall Barton's assistance
came up with =Mid(IIf([Field1] <> "", ", " & [Field1],"")
& IIf([Field2] <> "", ", " & [Field2],"") & IIf([Field3]
<> "", ", " & [Field3],""),3), which worked, but I could
not get the text box to shrink when there were no values
in the fields. To explain a bit more, the report prints a
series of records. Even with no values in the Field1,
etc., the field took up vertical space on the report. I
was able to determine through trial and error that the
text box containing the expression was the culprit. All
Can Shrink properties were set as needed, including in the
report detail. Setting the text box visible property to
No did not solve the problem, so I didn't try to solve the
problem through code. The report's source is a query, so
I put the expressions into query fields, and put those
fields into the text boxes. That worked, and they shrank
as planned when they were empty.
If a report is based on a table, this approach will not
work. I would need to make a query. This is not
necessarily a problem, but is it the best choice? Am I
overlooking something here?
 
One way is on the onformat of the detail check this fields
value and set the field height property within the code.
such as
if isnull(me.field) then
me.field.height = 0
else
me.field.height = 400
end if

the height number is in pixels
 
Thanks. It is good to know I have that option. I can
already think of one place where I can use it. Will Can
Grow and Can Shrink properties work in conjunction with
your method? In my case the information will sometimes be
on one line, and sometimes on several.
-----Original Message-----
One way is on the onformat of the detail check this fields
value and set the field height property within the code.
such as
if isnull(me.field) then
me.field.height = 0
else
me.field.height = 400
end if

the height number is in pixels

-----Original Message-----
I have received a great deal of help from this newsgroup,
enabling me to find a way to properly format a report. I
was having trouble with one aspect of it, and I found a
solution that worked, but it will come up again, so I want
to find out as much as I can now. I needed a concatenated
value in a text box, and with Marshall Barton's assistance
came up with =Mid(IIf([Field1] <> "", ", " & [Field1],"")
& IIf([Field2] <> "", ", " & [Field2],"") & IIf([Field3]
<> "", ", " & [Field3],""),3), which worked, but I could
not get the text box to shrink when there were no values
in the fields. To explain a bit more, the report prints a
series of records. Even with no values in the Field1,
etc., the field took up vertical space on the report. I
was able to determine through trial and error that the
text box containing the expression was the culprit. All
Can Shrink properties were set as needed, including in the
report detail. Setting the text box visible property to
No did not solve the problem, so I didn't try to solve the
problem through code. The report's source is a query, so
I put the expressions into query fields, and put those
fields into the text boxes. That worked, and they shrank
as planned when they were empty.
If a report is based on a table, this approach will not
work. I would need to make a query. This is not
necessarily a problem, but is it the best choice? Am I
overlooking something here?
.
.
 
Back
Top