Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with IIF Statement please. 2

Status
Not open for further replies.

Rene1024

MIS
Jul 24, 2003
142
US
Hello,

I'm trying to merge some fields to create a mailing address. I have the following fields:
AddrNum
Street
StreetDir
Unittype
UnitNumber

I would like to use the IIF statement on an update query to populate a new column called mailing address. In the Unitetype and Unitnumber columns I have some null values that I need to ignore when making the update.

Thanks for your help.

Rgds.

Rene
 
Take a look at the Nz function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks for your reply PHV.

I'm not too familiar with the NZ function, I was hopping that I could do something like:

addrnum&" "&street&" "&streetdir&" "&unittype&" "&unitnumber

without bringing blank spaces when values were null.

Is this possible?

Thanks again for your help.

Rgds.

Rene
 
You could try something like this:

Code:
Dim strAddress As String

strAddress = IIf(IsNull([addrnum]), vbNullString, [addrnum]) & _
             IIf(IsNull([street]), vbNullString, " " & [street])

and then keep going for the rest of your variables.

strAddress = vbNullString is basically the same thing as strAddress = "" but I've heard it runs faster in Access.

Hope some of that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top