| |
You are here: Experts > Computing/Technology > Business Software > Using MS Access > adding to fields in a query
Expert: Scottgem
Date: 9/5/2008
Subject: adding to fields in a query
Question Hi, thank you very much for taking the time to answering my question.
I would like to add two fields in a query and I want to place a / in between them. But if the first or second or both fields is/are blank I don't want the / to be part of the query result. Also I don't want a space to be in front of the result if the first field is blank.
Answer You can use an IIF to add the /. For example:
field1 & IIF(IsNull(field1) And IsNull(field2),"", IIF(Not IsNull(field1) AND Not IsNull(field2),"/",,"")
That should only show a slash if both are not null.
Hope this helps,
Scott<>
Microsoft Access MVP 2007
Author: MS Office Access 2007 VBA
Add to this Answer
Ask a Question
|
|