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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Removing commas if there is nothing after the field 2

Status
Not open for further replies.

dinster

Programmer
Apr 12, 2007
54
GB

GP_Address: [GP Add1] & ", " & [GP Add2] & ", " & [GP Add3] & ", " & [GP Add4] & ", " & [GP Postode]

i've put that in access query and wanted to know if there is nothing in either field names then do not include the comma.

Is this possible and could someone show me an example


many thanks
 
How about something like:

Code:
GP_Address: [GP Add1] 
  & Iif(IsNull([GP Add2]),"",", " & [GP Add2]) 
  & Iif(IsNull([GP Add3]),"",", " & [GP Add3]) 
  & Iif(IsNull([GP Add4]),"",", " & [GP Add4]) 
  & Iif(IsNull([GP Postcode]),"",", " & [GP Postcode])

May need some fiddling to work as you desire.


-V
 
Provided the fields are Null instead of ZeroLength:
GP_Address: [GP Add1] & (", " + [GP Add2]) & (", " + [GP Add3]) & (", " + [GP Add4]) & (", " + [GP Postode])

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top