C
Charles
I noticed a solution regarding padding in the MS Newgroup. I would like to left pad within MS Access based upon the value being positive or negative.
For example:
When using the Format (XXX,'000000000') function below, the result includes the negative however, when the data is exported the last digit is lost. The LPAD function (see code below) includes the negative, but it is embedded within number. I would like the format be ("-00000573") with the "-" as the leading character (in essence a 0 pad with 0 character-length)--see NEG_IF column. If accomplish, data can be imported appropriately.
Please reply or send me an e-mail at (e-mail address removed). Your assistance is GREATLY appreciated!
Regards,
-> Charles
AMOUNT FORMAT NEG_IF LPAD
377.54 000037754 000037754 000037754
288 000028800 000028800 000028800
184.52 000018452 000018452 000018452
-5.73 -000000573 -00000573 00000-573
450 000045000 000045000 000045000
-116.31 -000011631 -00011631 000-11631
671.74 000067174 0 00067174 000067174
LPAD CODE:
Function Lpad(MyValue As String, MyPadCharacter As String, _
MyPaddedLength As Integer)
Lpad = String(MyPaddedLength - Len(MyValue), MyPadCharacter) _
& MyValue
End Function
###
For example:
When using the Format (XXX,'000000000') function below, the result includes the negative however, when the data is exported the last digit is lost. The LPAD function (see code below) includes the negative, but it is embedded within number. I would like the format be ("-00000573") with the "-" as the leading character (in essence a 0 pad with 0 character-length)--see NEG_IF column. If accomplish, data can be imported appropriately.
Please reply or send me an e-mail at (e-mail address removed). Your assistance is GREATLY appreciated!
Regards,
-> Charles
AMOUNT FORMAT NEG_IF LPAD
377.54 000037754 000037754 000037754
288 000028800 000028800 000028800
184.52 000018452 000018452 000018452
-5.73 -000000573 -00000573 00000-573
450 000045000 000045000 000045000
-116.31 -000011631 -00011631 000-11631
671.74 000067174 0 00067174 000067174
LPAD CODE:
Function Lpad(MyValue As String, MyPadCharacter As String, _
MyPaddedLength As Integer)
Lpad = String(MyPaddedLength - Len(MyValue), MyPadCharacter) _
& MyValue
End Function
###