input mask/format for currency

Roni Sutton

Registered User.
Local time
Today, 22:19
Joined
Oct 18, 1999
Messages
68
I have users that requested to not have to input the decimal into currency fields. For example, to input $34.25, they want to simply type 3425. I did this by dividing the amount in the field by 100 in the after update property. NOW they want to also be able to input the decimal. SO if a user enters 3425 the field becomes $34.25 OR if a user prefers to enter 34.25 the field becomes $34.25. I thought I might could do this with an input mask, but that doesn't seem to work. Any ideas? Thanks, Roni
 
Use an if then to cover both cases
IF instr(".", fieldname,1)=0 then
fieldname/100
end if

so in the afterupdate it looks in the field to determine if the decimal has been entered. If not, if divides by 100, if so it doesn't.

[This message has been edited by charityg (edited 05-22-2001).]
 
I thought about that, but wasn't sure it would work since the format of the field is currency and it always has the decimal. I'll try it. Thanks!
 
This works unless the user enters zeros after the decimal. If the user enters 100.25 it works, but if she enters 100.00, it drops the decimal and the two zeros before checking. I had to convert the field to a string by setting a variable equal to str([fieldname]) so that I didn't get a data type mismatch error. When I convert 100.00 to a string, it comes in as 100. I am getting much closer, but still need a little help. Thanks! Roni
 

Users who are viewing this thread

Back
Top Bottom