问题
I want a numeric field to be always displayed as a 3-digit number. Padded left with 0s as needed.
Example: 3 is shown as 003, 24 as 024 and so on. Assuming max number is 999.
How do I do so? Thanks.
回答1:
Function Lpad (Value as String, PadCharacter as String, PaddedLength as Integer)
Lpad = string(PaddedLength - Len(Value), PadCharacter) & Value
End Function
Ref.
Lpad("3", "0", 3)
来源:https://stackoverflow.com/questions/15456871/how-to-format-a-numeric-field-in-microsoft-access