How to format a numeric field in Microsoft Access?

2019-09-09 09:33发布

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条回答
相关推荐>>
2楼-- · 2019-09-09 09:57
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)
查看更多
登录 后发表回答