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

Concatenating Fields 2

Status
Not open for further replies.

lars7

Technical User
Aug 16, 2005
817
GB
I would like to concatenate fields in a Query and divide them with a / sign. The problem is that not all the records in one of the fields have a value like:


Code Additionalcode
PMHAC34 01
PPCNM56
PSSANC62 12

And so on...

I would like the finished field to look like this:

Code
PMHAC34/01
PPCNM56
PSSANC62/12

But not like this:

Code
PMHAC34/01
PPCNM56/
PSSANC62/12


Does anyone know how to do this or an easier way to go about it?
 
Try
Code:
Select [Code] & IIF(IsNull(AdditionalCode),"","/" & AdditionalCode) As [NewCode], ...
 
Code:
Concat: [TableName]![Field1] & IIf([TableName]![Field2]<>"",("/" & [Table2]![Field2]),"")

________________________________________________________
Zameer Abdulla
Help to find Missing people
All cats love fish but fear to wet their paws..
 
Thanks to you both for your quick responce. I tried:

Newcode:
Code:
 & IIf(IsNull([Additionalcode]),"","/" & [Additionalcode])

In the Query and it worked.

Once again many thanks.
 
I would use:
Concat: [TableName]![Field1] & "/" + [Table2]![Field2]

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top