Calculated control with IF

L

Lasse T

Hello !!

I have a form with a calculated field named "tot" in the sub form looking
like this: =Sum([Relation]!Radsumma)
I also have another field named "kundkat" in the parent form wich can have
one of three values 1, 2, 3.

This is what i want to do.

If the field "kundkat" = 1 or 2 then the field tot =
Sum([Relation]!Radsumma)
If the field "kundkat" = 3 then the field "tot" = Sum([Relation]!Radsumma)
rounded down to nearest 5.

Hope someone can help me with this.

Thanks in advance

Lasse T
--------------
 
S

Steve Schapel

Lasse,

Try this...
=IIf([kundkat]=3,(Sum([Relation].Radsumma)\5)*5,Sum([Relation].Radsumma))
 
L

Lasse T

Hello and thank you for your ansver.

I tried this but can not get it to work. I get an error saying that a
paranthese or something is missing. Could you pleas check it again? I tried
to change it in all the ways I could come up with.


Lasse T
--------------

Steve Schapel said:
Lasse,

Try this...
=IIf([kundkat]=3,(Sum([Relation].Radsumma)\5)*5,Sum([Relation].Radsumma))

--
Steve Schapel, Microsoft Access MVP


Lasse said:
Hello !!

I have a form with a calculated field named "tot" in the sub form looking
like this: =Sum([Relation]!Radsumma)
I also have another field named "kundkat" in the parent form wich can have
one of three values 1, 2, 3.

This is what i want to do.

If the field "kundkat" = 1 or 2 then the field tot =
Sum([Relation]!Radsumma)
If the field "kundkat" = 3 then the field "tot" = Sum([Relation]!Radsumma)
rounded down to nearest 5.

Hope someone can help me with this.

Thanks in advance

Lasse T
 
S

Steve Schapel

Lasse,

Sorry, at the moment, I can't see any error with the syntax of the
expression, but I'll check it again later. :)
 
J

John Vinson

I tried this but can not get it to work. I get an error saying that a
paranthese or something is missing. Could you pleas check it again? I tried
to change it in all the ways I could come up with.

Just a speculation: the Swedish language setting might require
semicolons rather than commas. Does

=IIf([kundkat]=3; (Sum([Relation].Radsumma)\5)*5;
Sum([Relation].Radsumma))
 

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

Top