在 MS Access 中连接值时如何保留前导零?
how do I retain a leading zero when concatinating values in MS Access?
我是 运行 2 个字段的串联,这些字段是格式化为 00
的数字字段。这是为了为数字 1-9 添加一个前导零。在一种形式中,我已经开始将这两个连接在一起,但是我丢失了前导 0。
Private Sub PartCodeBtn_Click()
Dim GroupVal As String
Dim CatVal As string
GroupVal = Me!Prt_GroupDS.Form![Group_Number]
CatVal = Me!Part_Cat_DS.Form![PartCat_Number]
part_type_code = GroupVal & " " & CatVal
我得到的部件类型代码结果是 32 1
而不是 32 01
。
有谁知道如何保持前导零,或者为什么我丢失了它?
我认为part_type_code是一个字符串,所以尝试:
part_type_code = Format$(GroupVal, "00") & " " & Format$(CatVal, "00")
我是 运行 2 个字段的串联,这些字段是格式化为 00
的数字字段。这是为了为数字 1-9 添加一个前导零。在一种形式中,我已经开始将这两个连接在一起,但是我丢失了前导 0。
Private Sub PartCodeBtn_Click()
Dim GroupVal As String
Dim CatVal As string
GroupVal = Me!Prt_GroupDS.Form![Group_Number]
CatVal = Me!Part_Cat_DS.Form![PartCat_Number]
part_type_code = GroupVal & " " & CatVal
我得到的部件类型代码结果是 32 1
而不是 32 01
。
有谁知道如何保持前导零,或者为什么我丢失了它?
我认为part_type_code是一个字符串,所以尝试:
part_type_code = Format$(GroupVal, "00") & " " & Format$(CatVal, "00")