Extending Lines and Shrinking Fields with No Data

  • Thread starter Thread starter pronational
  • Start date Start date
P

pronational

Guest
I have a report where several address lines are needed and I have the CanGrow option on. So when the field grows to fit the info the lines surrounding the box do not and I have blank space in between records. Is there any way to fix this? Also, if there is not any info for one of the address lines is there any way to eliminate the empty space so there is not gaps in the address?
 
What I do is use a UDF to return a multiline string to a textbox on my report. I can then put a border around the textbox that shrinks and grows with the textbox. Here is the UDF:

Function NoBlanks$(L1, L2, L3, L4)

Function NoBlanks$(L1, Optional L2, Optional L3, Optional L4)
Dim A1$, A2$, A3$, A4$, CR$
On Error Resume Next
CR$ = Chr(13) & Chr(10) 'Carriage return and line feed.
A1$ = IIf(IsNull(L1), "", L1 & CR$)
A2$ = IIf(IsNull(L2), "", L2 & CR$)
A3$ = IIf(IsNull(L3), "", L3 & CR$)
A4$ = IIf(IsNull(L4), "", L4 & CR$)
NoBlanks = A1$ & A2$ & A3$ & A4$ 'Concatenate the strings.
End Function


In an unbound textbox on your report just enter something like this:

=noblanks([namefield],[addressfield],[address2field],[cityfield])
 
I tried using the function and I keep getting a #Name? error.
 

Users who are viewing this thread

Back
Top Bottom