PC Review


Reply
Thread Tools Rate Thread

Combine / Concatenate text and include a carraige return

 
 
ruperthouse
Guest
Posts: n/a
 
      24th Mar 2010
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.
 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      24th Mar 2010
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
 
Reply With Quote
 
Duane Hookom
Guest
Posts: n/a
 
      24th Mar 2010
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
>
> .
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Carraige return Lance Richmond Microsoft Dot NET 0 1st Apr 2008 08:20 AM
Using concatenate to include a line return =?Utf-8?B?ZGFu?= Microsoft Excel Misc 1 26th Jan 2006 01:52 PM
If statement for Carraige Return?? =?Utf-8?B?S2VuIENoYW4=?= Microsoft Access External Data 0 3rd Aug 2004 09:27 AM
Action A Carraige Return To A Text File Dave Microsoft Excel Programming 0 18th Sep 2003 09:05 PM
Action A Carraige Return To A Text File Dave Microsoft Excel Programming 0 18th Sep 2003 07:12 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:25 PM.