IIf query

  • Thread starter samotek via AccessMonster.com
  • Start date
S

samotek via AccessMonster.com

I have a working query with the following calculation:

Expr1: [office]*[size]*[cartons]*[pack]

I want to improve the calculation in that when the [cartons] is Null, the
expression should be

[office]*[size]*[quantity]*[pack]

I know i have to use the IIf but how could i do it ?

I have tried with the following expression, but i get errors,saying i have
wrong syntax .Can you help me ?


Expr1:iif([Cartons]is null,[Quantity],[Cartons];[office]*[size]*[cartons]*
[pack]
 
A

Allen Browne

Use Nz() to treat the null as 1:

Expr1: [office] * [size] * [cartons] * [pack] * Nz([Cartons],1)
 
S

samotek via AccessMonster.com

Thank you very much ! It works fine now !

Allen said:
Use Nz() to treat the null as 1:

Expr1: [office] * [size] * [cartons] * [pack] * Nz([Cartons],1)
I have a working query with the following calculation:
[quoted text clipped - 12 lines]
Expr1:iif([Cartons]is null,[Quantity],[Cartons];[office]*[size]*[cartons]*
[pack]
 
S

samotek via AccessMonster.com

Thank you very much ! It works fine now !

Allen said:
Use Nz() to treat the null as 1:

Expr1: [office] * [size] * [cartons] * [pack] * Nz([Cartons],1)
I have a working query with the following calculation:
[quoted text clipped - 12 lines]
Expr1:iif([Cartons]is null,[Quantity],[Cartons];[office]*[size]*[cartons]*
[pack]
 

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