문제

On a report I have the following code for a field:

=Sum([PartQty]*[ModuleQty])

Example results are 2.1 and 2.6. What I need is for these value to round up to the value of 3. How can I change my field code to always round up the results of my current expression?

도움이 되었습니까?

해결책

you could do

=Int(Sum([PartQty]*[ModuleQty]))+1

I think. That would get the Int part of the sum (2) and then add 1. you might need to be a little more clever as this will probably give you 3 even if the sum is exactly 2, which is probably not what you want.

not tested it but something along these lines might work (access syntax is not that great, but should give you the right idea) :

Iif(Sum([PartQty]*[ModuleQty])-Int(Sum([PartQty]*[ModuleQty]))=0,
     Sum([PartQty]*[ModuleQty]),
     Int(Sum([PartQty]*[ModuleQty]))+1)

다른 팁

This is an old Access trick I learned a very long time ago, and it makes use of the way Access handles fractional, negative numbers. Try this:

-Int(-[DecimalValue])

It's odd, but it will always round your numbers up to the nearest whole number.

글쎄,이 일을하는 가장 좋은 방법은 아니지만, 여기서는 작동하는 방법이 있습니다

import java.lang.*;

public class T {
  public static void main(String[] args) {
    String s = "1090412";
    for (int i = 10; i <= 20; i++) {
      s = s.replace(Integer.toString(i), "" + (char)(i + 55));
    }
    System.out.println(s);
  }
}
.

java.lang.String 객체는 그것에 대체 방법을 가지고 있습니다.두 개의 char 매개 변수 또는 두 개의 CharSequence를 찍는 데 과부하됩니다 객체."" + (char)(i + 55)는 CharSequence를 생성하는 빠른 방법입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top