Stuart Green
Registered User.
- Local time
- Today, 08:35
- Joined
- Jun 24, 2002
- Messages
- 108
I am trying to create a fixed format datafile which contains currency amounts. The problem is that the format the values have to be in "drops" the decimal point and also has to be paddded out to 11 characters. Example
102.56
978.56
126.70
should be in the file as follows
00000010256
00000097856
00000012670
I can "sort of" get there using format, the problem is with the last example where the value is 126.70. This is treated as 126.7 and gives a result of
00000001267 (equates to £12.67) when it should be
00000012670 (£126.70)
Have tried splitting off the pence using RIGHT([value],2) with a view to then adding back to the pounds but to no avail as it ingores the zero amount and gives .7 rather than 70.
Have tried using CStr but same problem arises where the value is really only 1 decimal place
Am now at the end of my tether! Any suggestions short of sacrificing an animal at midnight under a full moon would be much appreciated (yes I am that desperate).
102.56
978.56
126.70
should be in the file as follows
00000010256
00000097856
00000012670
I can "sort of" get there using format, the problem is with the last example where the value is 126.70. This is treated as 126.7 and gives a result of
00000001267 (equates to £12.67) when it should be
00000012670 (£126.70)
Have tried splitting off the pence using RIGHT([value],2) with a view to then adding back to the pounds but to no avail as it ingores the zero amount and gives .7 rather than 70.
Have tried using CStr but same problem arises where the value is really only 1 decimal place
Am now at the end of my tether! Any suggestions short of sacrificing an animal at midnight under a full moon would be much appreciated (yes I am that desperate).