How do I set up IIf statements?

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

Guest

I am currently setting up an access database and would like some help with an
IIf statement.

I would like to build an expression stating that "If nothing is entered into
the field (Customer address) on each record please go to the customer table
and take the address from there. Basically if there isn't a despatch address
I want to enter the invoice address in the field instead.

Probably very simple but I am getting lots of error messages!
 
I am currently setting up an access database and would like some help with an
IIf statement.

I would like to build an expression stating that "If nothing is entered into
the field (Customer address) on each record please go to the customer table
and take the address from there. Basically if there isn't a despatch address
I want to enter the invoice address in the field instead.

Probably very simple but I am getting lots of error messages!

Next time you have code or an expression that doesn't work please post
what you have already tried. Sometimes our crystal balls gets foggy!
Also, sometimes it makes a difference where you are trying to do this.
A Form, Report, Query, VBA, etc.
Let us know.

As a guess...

=IIf(IsNull([CustomerAddress]),DLookUp("[AddressField]","CustomerTable","[CustomerID]
= " & [CustomerID]),[CustomerAddress])

The above assumes that [CustomerID] is the name of your record's
unique prime key field, is a number datatype, and is available on the
form or report that this is being done on.
 
Back
Top