Format a number with leading blanks

S

SHIPP

How do I format a number in a query so that I left fill a number with blanks.
In other words if I have the number 22 I want 9 blanks in front of it. If I
have the number 101 I want 8 blanks in front of it. If I have the number 7 I
want 10 blanks in front of it. I'm using Access 97. Thanks in advance.
 
S

SHIPP

I solved the problem with the following code.


Public Function FillField(lngFld As Long) As String

Dim strFld As String

strFld = Trim(CStr(lngFld))

While Len(strFld) < 11
strFld = " " & strFld
Wend
FillField = strFld

End Function
 
Top