Ok, so I don't know that much about vbScripts, but I am using this one to make the text on the label concatenate to fields into the label, wrap the text at a certain number of characters and insert a new line.
Function FindLabel ( [NAME], [PARKING_SP] )
FindLabel = " [NAME] & [PARKING_SP] "
Dim finalLabel, strInput, curChar, PWS, CWS
Dim c, numChars, senLimit, numSpaces, spaceIter, CWSLen
strInput = [NAME] & vbNewLine & [PARKING_SP] '* label field names NAME & PARKING_SP
intInput = [PARKING_SP]
senLimit = 15 '*sentence limit is 15
finalLabel = ""
strLabel = ""
intLabel = ""
numChars = Len(strInput)
'Determine number of spaces in string
numSpaces = 0
c = 0
Do Until (c = numChars)
c = c + 1
curChar = Mid(strInput, c, 1)
If (curChar = " ") Then
numSpaces = numSpaces + 1
End If
Loop
c=0
Do Until (spaceIter = numSpaces + 1)
Do Until (curChar = " ") Or ((c + 1) > numChars)
c = c + 1
curChar = Mid(strInput, c, 1)
CWS = CWS + curChar
Loop
CWSLen = Len(CWS)
If (CWSLen > senLimit) Then
PWS = Left(CWS, (CWSLen - 1))
PWSLen = Len(PWS)
If (Len(PWS) > senLimit) Then
Do Until (Right(PWS, 1) = " ")
PWS = Left(PWS, PWSLen)
PWSLen = PWSLen - 1
c = c - 1
Loop
End If
curChar = "dummy"
PWS = Trim(PWS)
If (finalLabel <> "") Then
finalLabel = finalLabel & vbNewLine & PWS
Else
finalLabel = PWS
End If
CWS = ""
spaceIter = spaceIter - 1
Else
If ((c + 1) <= numChars) Then
PWS = Left(CWS, (CWSLen - 1))
curChar = "dummy"
End If
spaceIter = spaceIter + 1
End If
Loop
If (finalLabel <> "") Then
finalLabel = finalLabel & vbNewLine & CWS
Else
finalLabel = cws
End If
FindLabel = finalLabel
End Function
The problem is that it is cutting off the final character in the last line that is pulling in the number of parking spaces, but only on
*some* of the labels, not all of them....help!