View Full Version : How to use expressions with missing values


Maximnl
06-11-2007, 11:47 AM
I use a left join to join table A with table B. Table B has less matching records , so in the resulting table the field [RESULT] which comes from the table B has empty values.

If I use an expression for a new field PROCENT that involves [RESULT] I got #ERROR in all records with missing [RESULT] value. I tried various IF statements , but even IsError () function produces #ERROR.

It seems that ACCESS 2002 fails to detect missing values and gives an error for any operation. Is there any workaround for this problem?



Example
PROD_PERCENT: IIf([RESULT]>0,[RESULT]/[NETTO],0)

rainman89
06-11-2007, 11:49 AM
have you looked into the NZ function?

Rich
06-11-2007, 12:08 PM
Missing values, or missing records, it sounds as though you need to change the join

KeithG
06-11-2007, 12:49 PM
The Nz function is what you need

Nz([Field],[ValueIfFieldIsNull)

Maximnl
06-11-2007, 01:57 PM
The problem field has value #Error for the missing values, and non of Access functions iserror(), isnull() can detect it. Very strange. Any function which I apply produces #Error again.

Interesing insight: is there difference between missing records and missing values? In a join, a missing record should produce missing values. In my case something else is made by access, that it cannot even detect itself.

Some details: the right join is on two fields, but it should not cause such problems.

KeithG
06-11-2007, 03:10 PM
Is the field already an expression? This is the only way it would say #error. The Nz function will convert a null value into a value specified by the function. I would assume you are recieving #error because you are trying to calculate a NULL value.