IIF function qry run from 2 tables

K

KarenY

I can have the 'blank' field worked out into "0", but I can't have it with 2
tables.
Please help.

I have 2 tables :
field [PN] and [UnitPrice] in tbl 1
field [PN] and [ListPrice] in tbl 2

here's my function in the qry:
UnitList: (IIf([UnitPrice]=0,[ListPrice],[UnitPrice]))

I want the 0-priced PN in tbl 1 to pick up the price in tbl 2 if there is,
if no price in tbl 2, then back to the 0-price in tbl 1. Yet it doesn't
work, it returns as "blank" not "0", it's probably no [PN] in tbl 2.

thanks,
Karen
 
K

kc-mass

Hi Karen
Try: UnitList: (IIf([UnitPrice]=0,NZ([ListPrice]),[UnitPrice]))

That way if the query hits a null on table2 price you get a "0" instead of a
blank.

Try it

Kevin
 
K

KarenY

Thank you, it works !
(sorry, a bit late to reply cuz of my leave...)

kc-mass said:
Hi Karen
Try: UnitList: (IIf([UnitPrice]=0,NZ([ListPrice]),[UnitPrice]))

That way if the query hits a null on table2 price you get a "0" instead of a
blank.

Try it

Kevin

KarenY said:
I can have the 'blank' field worked out into "0", but I can't have it with
2
tables.
Please help.

I have 2 tables :
field [PN] and [UnitPrice] in tbl 1
field [PN] and [ListPrice] in tbl 2

here's my function in the qry:
UnitList: (IIf([UnitPrice]=0,[ListPrice],[UnitPrice]))

I want the 0-priced PN in tbl 1 to pick up the price in tbl 2 if there is,
if no price in tbl 2, then back to the 0-price in tbl 1. Yet it doesn't
work, it returns as "blank" not "0", it's probably no [PN] in tbl 2.

thanks,
Karen
 

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