RE: Query Question

Tech-Archive recommends: Fix windows errors by optimizing your registry



Try this

Trim([Address1] & iif([Address2] not is null, ", " & [Address2],"") &
iif([Address3] not is null,", " & [Address3],"") & iif([County] not is
null,", " & [County],"") &
iif([PostCode] not is null, ", " & [PostCode],""))


"ingalla" wrote:

> I have the following query:-
>
> Trim([Address1] & ", " & [Address2] & ", " & [Address3] & ", " & [County] &
> ", " & [Country] & ", " & [PostCode])
>
> However, if any of the fields are blank how can i stop getting two commas
> together? ie if the address3 field is empty.
>
> Address1, Address2,, County, County, PostCode
>
> Thanks
>
> Andy
.



Relevant Pages

  • Re: Query Question
    ... This is not Standard SQL but ... This will fail if you have zero-length strings in the fields and not null ... ie if the address3 field is empty. ... > Address1, Address2,, County, County, PostCode ...
    (microsoft.public.access.queries)
  • Query Question
    ... if any of the fields are blank how can i stop getting two commas ... ie if the address3 field is empty. ... Address1, Address2,, County, County, PostCode ...
    (microsoft.public.access.queries)