A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Setting Up & Running Reports
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Combine / Concatenate text and include a carraige return



 
 
Thread Tools Display Modes
  #1  
Old March 24th, 2010, 08:17 PM posted to microsoft.public.access.reports
ruperthouse
external usenet poster
 
Posts: 6
Default Combine / Concatenate text and include a carraige return

In my Access report I would like the fields: address, town, county, postcode
to be combined but put on separate lines. I don't want to use separate
unbound boxes for them as sometimes address is a different number of lines or
town or county is blank and I don't want blank lines.

Is there a syntax for carriage return so I can use something like

[address] & CR & [town] & CR & [county] & " " & [postcoe] where CR is the
carriage return symbol.

I've trawled help but can't find it.
  #2  
Old March 24th, 2010, 09:52 PM posted to microsoft.public.access.reports
PieterLinden via AccessMonster.com
external usenet poster
 
Posts: 307
Default Combine / Concatenate text and include a carraige return

ruperthouse wrote:
In my Access report I would like the fields: address, town, county, postcode
to be combined but put on separate lines. I don't want to use separate
unbound boxes for them as sometimes address is a different number of lines or
town or county is blank and I don't want blank lines.

Is there a syntax for carriage return so I can use something like

[address] & CR & [town] & CR & [county] & " " & [postcoe] where CR is the
carriage return symbol.

I've trawled help but can't find it.


instead of CR use vbCrLf. So your unbound textbox's control source would be
[address] & vbCrLf & [town] & ", " & vbCrLf & [county] & " " & [postcode]

--
Message posted via http://www.accessmonster.com

  #3  
Old March 24th, 2010, 10:20 PM posted to microsoft.public.access.reports
fredg
external usenet poster
 
Posts: 4,386
Default Combine / Concatenate text and include a carraige return

On Wed, 24 Mar 2010 13:17:01 -0700, ruperthouse wrote:

In my Access report I would like the fields: address, town, county, postcode
to be combined but put on separate lines. I don't want to use separate
unbound boxes for them as sometimes address is a different number of lines or
town or county is blank and I don't want blank lines.

Is there a syntax for carriage return so I can use something like

[address] & CR & [town] & CR & [county] & " " & [postcoe] where CR is the
carriage return symbol.

I've trawled help but can't find it.


In Access the chr(13) & chr(10) combination (in that order) will give
you a carriage return and line space.
In the control source of an unbound control, write:
= [address] & chr(13) & chr(10) & [town] & chr(13) & chr(10) &
[county] & " " & [postcoe]

In VBA you can use the above chr(13) & chr(10) combination or the VBA
contstants:
vbCrLf
or
vbNewLine

=[address] & vbNewLine & [town] etc....
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
  #4  
Old March 24th, 2010, 10:33 PM posted to microsoft.public.access.reports
Duane Hookom
external usenet poster
 
Posts: 7,177
Default Combine / Concatenate text and include a carraige return

You can't use vb constants in a control source or query expression. You can use
=[Field A] & chr(13) & chr(10) & [Field B] & Chr(13) & Chr(10) & [Field C]

--
Duane Hookom
Microsoft Access MVP


"PieterLinden via AccessMonster.com" wrote:

ruperthouse wrote:
In my Access report I would like the fields: address, town, county, postcode
to be combined but put on separate lines. I don't want to use separate
unbound boxes for them as sometimes address is a different number of lines or
town or county is blank and I don't want blank lines.

Is there a syntax for carriage return so I can use something like

[address] & CR & [town] & CR & [county] & " " & [postcoe] where CR is the
carriage return symbol.

I've trawled help but can't find it.


instead of CR use vbCrLf. So your unbound textbox's control source would be
[address] & vbCrLf & [town] & ", " & vbCrLf & [county] & " " & [postcode]

--
Message posted via http://www.accessmonster.com

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:41 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.