Access program limit?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!
I use a textbox to calculate the total value. Here is my code, when I use
3 standard, it works fine. However, now I add one more standard value, it
will crash. Did I reach the Access limit? Is any other way to solve? Thank
you.

=Sum(IIf([Standard]=0.1,(IIf(([A]*[Density]/100)>=0.08,0.08,([A]*[Density]/100))),(IIf([Standard]=0.2,(IIf(([A]*[Density]/100)>=0.15,0.15,([A]*[Density]/100))),(IIf([Standard]=0.3,(IIf(([A]*[Density]/100)>=0.20,0.20,([A]*[Density]/100))),(IIf([Standard]=0.4,(IIf(([A]*[Density]/100)>=0.37,0.37,([A]*[Density]/100))),0))))))))
 
The logic is if the standard value is X, A*density value over the max value,
then use the max value, otherwise using the calculated value. And there is 4
standards.

Fox
 
Write a user-defined function in a module. Name your module
"modBusinessCalcs". Use the function in your query, in your control sources,
in your code, and in your application documentation.

I can't imagine attempting to maintain an expression like this in a query or
control source. If you get to more than 2 IIf()s, use code.
 
Yes, thank you very much. I learn another tip.........:>

Duane Hookom said:
Write a user-defined function in a module. Name your module
"modBusinessCalcs". Use the function in your query, in your control sources,
in your code, and in your application documentation.

I can't imagine attempting to maintain an expression like this in a query or
control source. If you get to more than 2 IIf()s, use code.

--
Duane Hookom
MS Access MVP
--

fox said:
Hi!
I use a textbox to calculate the total value. Here is my code, when I
use
3 standard, it works fine. However, now I add one more standard value, it
will crash. Did I reach the Access limit? Is any other way to solve? Thank
you.

=Sum(IIf([Standard]=0.1,(IIf(([A]*[Density]/100)>=0.08,0.08,([A]*[Density]/100))),(IIf([Standard]=0.2,(IIf(([A]*[Density]/100)>=0.15,0.15,([A]*[Density]/100))),(IIf([Standard]=0.3,(IIf(([A]*[Density]/100)>=0.20,0.20,([A]*[Density]/100))),(IIf([Standard]=0.4,(IIf(([A]*[Density]/100)>=0.37,0.37,([A]*[Density]/100))),0))))))))
 
Back
Top