J
Jumbo Shrimps, Jr.
The following bit of nasty code formats
the control in a datasheet to display the contents
of txtMonth1.
:
=IIf(Right([metric],1)="$",Format([txtMonth1],"$#,###"),
IIf([metric]="NEW Accts (ADV)",Format([txtMonth1],
"#,###"),IIf([metric]="Accts",Format([txtMonth1],
"#,###"),Format([txtMonth1],"#.##%"))))
TxtMonth1 can be a large number in
millions, or a small percentage like 1.01%
This code presents to the screen either
currency, int or percentages - the
only three formats required.
Datasheet looks like this:
Metric Month0 Month1 Month2
Accts 550 525 505
Bal$ $838,323 $799,342 $745,321
% Bal 99.85% 97.25% 95.35%
Loss Rate 1.02% 0.89% 0.95%
etc.
There are eight percentage metrics,
one currency and one fixed numeric that
is always an integer.
All but one of the percentage metrics
appear to the screen as "xx.xx%"
BUT one of the metrics appears as
77.2383830202% (example), as there
are over 50 controls on the data sheet -
all the same size, this truncates the
data for that one metric.
The table holding the data stores each
of the percentage metrics as Double/
Percent/2.
Each of the metrics is appended
into their fields by month - regardles of
format going in - Double seems to hold all
values large and small. The last default
format is the one that applies to data
stored as percentages and seems to work
on all metrics but the funky one.
the control in a datasheet to display the contents
of txtMonth1.
:
=IIf(Right([metric],1)="$",Format([txtMonth1],"$#,###"),
IIf([metric]="NEW Accts (ADV)",Format([txtMonth1],
"#,###"),IIf([metric]="Accts",Format([txtMonth1],
"#,###"),Format([txtMonth1],"#.##%"))))
TxtMonth1 can be a large number in
millions, or a small percentage like 1.01%
This code presents to the screen either
currency, int or percentages - the
only three formats required.
Datasheet looks like this:
Metric Month0 Month1 Month2
Accts 550 525 505
Bal$ $838,323 $799,342 $745,321
% Bal 99.85% 97.25% 95.35%
Loss Rate 1.02% 0.89% 0.95%
etc.
There are eight percentage metrics,
one currency and one fixed numeric that
is always an integer.
All but one of the percentage metrics
appear to the screen as "xx.xx%"
BUT one of the metrics appears as
77.2383830202% (example), as there
are over 50 controls on the data sheet -
all the same size, this truncates the
data for that one metric.
The table holding the data stores each
of the percentage metrics as Double/
Percent/2.
Each of the metrics is appended
into their fields by month - regardles of
format going in - Double seems to hold all
values large and small. The last default
format is the one that applies to data
stored as percentages and seems to work
on all metrics but the funky one.