CanShrinkLines Custom Function

B

BertaHill

I copied the function and created a module within my database to eliminate
blank lines in the address. This is the module:

Public Function CanShrinkLines(ParamArray arrLines())
'Pass this function the lines to be combined
'For example: strAddress =
'CanShrinkLines (Name, Address1, Address2, City, St, Zip)
Dim x As Integer, strLine As String
For x = 0 To UBound(arrLines)
If Not IsNull(arrLines(x)) And arrLines(x) <> "" Then
strLine = strLine & arrLines(x) & vbCrLf
End If
Next
CanShrinkLines = strLine
End Function

I created an unbound text box with the following expression:

=CanShrinkLines([Address1],[Address2],Trim([City]) & (", "+[State]) & " " &
[Zip],[Telephone],[E-mail])

However, I have two problems: The first is that the street address for the
first record gets replicated for each of the following records (but not the
other information). The second is that it's not picking up the Telephone and
E-mail fields.

What have I done wrong?
 

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