round Fraction

  • Thread starter Thread starter ghost
  • Start date Start date
G

ghost

Greeting,

I have the following fraction need to be rounded if they met cretin
conditions:
From 0.01 to 0.019 = 0
0.20 to 0.39 =0.25
0.40 to 0.60 =0.50

How to do that in form please??
 
SomeName: IIf([TableName]![YourNumberField] Between 0.01 And
0.19,0,IIf([TableName]![YourNumberField] Between 0.2 And
0.39,0.25,IIf([TableName]![YourNumberField] Between 0.4 And 0.6,0.5)))
 
You can call the Switch function. This accepts a list of expressions and
returns a value associated with the first expression which is True, so the
ControlSource for a text box on a form would be:

=Switch([YourField] > 0 And [YourField] < 0.2,0,[YourField] >= 0.2 And
[YourField] < 0.4,0.25,[YourField] >= 0.4 And [YourField] <= 0.6,0.5)

where YourField is the name of a field or control containing the original
number. For values less than zero or greater than 0.6 Null would be returned.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top