I have a function which puts zero's in front of my data. The number of zero's is based of the length I specify. Here's the function:
Function Pad(strText, nLen, strChar, bFront)
Dim nStartLen
If strChar = "" Then
strChar = "0"
End If
nStartLen = Len(strText)
If Len(strText) >= nLen Then
Pad = strText
Else
If bFront Then
Pad = String(nLen - Len(strText), strChar) & strText
Else
Pad = strText & String(nLen - Len(strText), strChar)
End If
End If
End Function
Here's the code that Pad's the zero's in front.
iCheckNumber = Pad(Replace(CStr(Request.Form("CheckNumber")), ".", ""), 9, "0", True)
so if my check number entered in the form was 243 then the Pad function would add the zero's to make it look like the following: 000000243
What I want is for the first six zero's to be blank spaces and then 243 so it would be like " 243" without the ""
Function Pad(strText, nLen, strChar, bFront)
Dim nStartLen
If strChar = "" Then
strChar = "0"
End If
nStartLen = Len(strText)
If Len(strText) >= nLen Then
Pad = strText
Else
If bFront Then
Pad = String(nLen - Len(strText), strChar) & strText
Else
Pad = strText & String(nLen - Len(strText), strChar)
End If
End If
End Function
Here's the code that Pad's the zero's in front.
iCheckNumber = Pad(Replace(CStr(Request.Form("CheckNumber")), ".", ""), 9, "0", True)
so if my check number entered in the form was 243 then the Pad function would add the zero's to make it look like the following: 000000243
What I want is for the first six zero's to be blank spaces and then 243 so it would be like " 243" without the ""