Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Hey can anyone help...

Author  Topic 

weedavie22
Starting Member

24 Posts

Posted - 2004-08-18 : 05:32:31
Wondering if anyone can help.
I have a section in my database that takes the individual fields of an contact address and combines them in a textbox.

The fields are [streetnum], [street], [town], [postcode] which in my textbox become:

= [streetnum]& "
" &[street] &"
"& [town] &"
"& [postcode]


which becomes

123
fake street
anytown
anypostcode


My question is, if one of the fields doesn't exist can I supress that blank field rather than having a space ie.

123

anytown
anypostcode


To,

123
anytown
anypostcode


Thanks for any help

Dave

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-08-18 : 05:42:06
well you could do something like this
nest the iif's in a way that works for you...

iif(isnull([street]), ' ' + iif(isnull([town]), '' + ..., [town]), [street])

Go with the flow & have fun! Else fight the flow :)
Go to Top of Page

weedavie22
Starting Member

24 Posts

Posted - 2004-08-18 : 06:25:36
Thanks for the quick reply, still not working though.

Its always these wee things that bug me in access :)



Go to Top of Page

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2004-08-18 : 06:47:25
spirit's has basically answered your question, you can accomplish this using the IIF and/or the Nz (Access's ISNULL equivalent) function.
You'll just need to do some experimentation to get it to work for you.
Go to Top of Page
   

- Advertisement -