Call formatting on a form

  • Thread starter Thread starter lsgKelly
  • Start date Start date
L

lsgKelly

I would like to create a function and use it on many fields of a specific
form. The function would format a number to $#,### if they put in a number
greater than zero, and ##% if they type in a number less than zero.

I have no idea how to even start this function. I know what I want it to
do, just not sure how to go about doing it. :)

Thanks in advance for your help.

Kelly
 
lsgKelly said:
I would like to create a function and use it on many fields of a specific
form. The function would format a number to $#,### if they put in a number
greater than zero, and ##% if they type in a number less than zero.

I have no idea how to even start this function. I know what I want it to
do, just not sure how to go about doing it. :)


Depends on whether users can edit the value. If the problem
is to just display the values, you can use an expression
like:

=Format(thenumber,IIf(thenumber<1, "0%", "#,##0")

OTOH, if you want users to be able to edit the number, then
it can not be done with a single text box. In this can, you
need the bound text box to be placed behind the formatted
text box and use a line of code in the formatted text box's
GotFocus event to reset the focus to the bound text box:
Me.theboundtextbox.SetFocus
 
That is how I originally set it up, but I'm trying to add an AuditTrail
function to this form, and those formatting fields will not record the
changes in the event log. I thought maybe there was another way to make
those changes, but evidently that is not the case.

Back to the drawing board. Thanks for the response.
 
lsgKelly said:
That is how I originally set it up, but I'm trying to add an AuditTrail
function to this form, and those formatting fields will not record the
changes in the event log. I thought maybe there was another way to make
those changes, but evidently that is not the case.

Back to the drawing board. Thanks for the response.


An audit trail?? How are you doing that?

And what does a calculated format have to do with tracking
changes to a record?
 
That is a good question! I ended up recreating the form one step at a time,
and it now works. It has exactly the same controls as the first form, except
now the Audit Trail works. What was happening, was when I made changes to
the formatted controls, it wouldn't tell me which control was updated, just
that there had been a change on the form.

It works now. Sometimes this coding stuff just baffles me. :)

Thanks for your help.
 
Back
Top