How to change the format of a displayed number in a form

  • Thread starter Thread starter Darrell Childress
  • Start date Start date
D

Darrell Childress

I am developing an HR database and trying to show deductions for each
employee on a subform. The 2 relevant fields are "dedid" and "dedrate".
"dedrate" is a number field but can mean 2 different things.

If dedid = 401, then dedrate is a percentage
If dedid = 401$, then dedrate is a dollar amount

I would like my form to reflect this. In other words, if the field
"dedid" = 401 and "dedrate" = 2, then I would like the number in field
dedrate to display as 2%. But if "dedid" = 401$ and "dedrate" = 15, then
I would like the number in field dedrate to display as $15.00

By the way, the records are from a linked table in Visual FoxPro, so I
cannot change the format of the stored value.
Thanks for any help,
Darrell
 
In the Current Event of your form:

If dedid = "410" Then
Me.txtdedrate.format = "percent"
Else
Me.txtdedrate.format = "currency"
End If

You are mixing definitions of fields and text boxes (fields are in tables -
controls are on forms) is you will have to change the names to get what you
want.
 
Back
Top