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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Mailing Address



 
 
Thread Tools Display Modes
  #1  
Old February 7th, 2009, 08:28 AM posted to microsoft.public.access.gettingstarted
Roger Bell
external usenet poster
 
Posts: 275
Default Mailing Address

I have a text box on a Report as follows:

=Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10) &
Trim([unit/flat] & " " & [unit/flat no] & Chr(13) & Chr(10) & "" & ([street
number] & "" & [street prefix] & " " & [street name]) & Chr(13) & Chr(10) &
Trim([suburb] & " " & [state] & " " & [pcode]))

What I would like is when there is no Unit/Flat, that the line space will be
closed up.

Could someone please advise how this can be achieved?

Many thanks
  #2  
Old February 7th, 2009, 04:22 PM posted to microsoft.public.access.gettingstarted
MikeJohnB
external usenet poster
 
Posts: 464
Default Mailing Address

Hi Roger

I just cannot get your code to work for testing, I have seen the other
threads you have posted but have a different answer

=Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10) &
IIf(Len([unit/flat] & " " & [unit/flat no])1,[unit/flat] & " " & [unit/flat
no] & Chr(13) & Chr(10),"") & [street number] & " " & [street prefix] & " " &
[street name] & Chr(13) & Chr(10) & Trim([suburb] & " " & [state] & " " &
[pcode])

All the above is one line. The IIF(Len statement takes out the Empty
unit/flat and unit/flat no and doesn't add the endline code allowing the
following code to fall into the space where these two objects would have been.

I don't know if this is exactly what you want, I have tested it here and all
works but you will have to adapt it for your circumstances and field types I
guess.

I am not sure what you are doing with the trim function, haven't really
concentrated on that, I think John gave you pointers on that?

I hope this helps??????

Regards

Mike B
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B


"Roger Bell" wrote:

I have a text box on a Report as follows:

=Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10) &
Trim([unit/flat] & " " & [unit/flat no] & Chr(13) & Chr(10) & "" & ([street
number] & "" & [street prefix] & " " & [street name]) & Chr(13) & Chr(10) &
Trim([suburb] & " " & [state] & " " & [pcode]))

What I would like is when there is no Unit/Flat, that the line space will be
closed up.

Could someone please advise how this can be achieved?

Many thanks

  #3  
Old February 7th, 2009, 04:31 PM posted to microsoft.public.access.gettingstarted
MikeJohnB
external usenet poster
 
Posts: 464
Default Mailing Address

Hi Roger, I will try to post this one more time, been getting errors.

I have tested the following code, I cannot get your code to work here but
that may be a field type difference.

=Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10) &
IIf(Len([unit/flat] & " " & [unit/flat no])1,[unit/flat] & " " & [unit/flat
no] & Chr(13) & Chr(10),"") & [street number] & " " & [street prefix] & " " &
[street name] & Chr(13) & Chr(10) & Trim([suburb] & " " & [state] & " " &
[pcode])

This code is all one line, I have not looked at what you are doing with the
trim function and have concentrated on your request. I think John gave you
pointers to that in a previous thread.

The above code removes the flat/unit and flat/unit no if they are "" length,
the IIF(Len(unit/flat] & " " & [unit/flat no])1 part allows for the fact
that you have a space which is one character long. If it is greater than one
character, the unit/flat (a space) and the unit/flat no is printed to the
text box and a line feed end line. If it = 1, then nothing is printed to the
textbox and no line feed end line allowing the rest of the code to run on
from there.

I hope I have interpreted your requirements????

Regards
Mike B
--
Advice to Posters.
Check your post for replies or request for more information.
Consider providing some feed back to the response you have recieved.
Kindest Regards Mike B


"Roger Bell" wrote:

I have a text box on a Report as follows:

=Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10) &
Trim([unit/flat] & " " & [unit/flat no] & Chr(13) & Chr(10) & "" & ([street
number] & "" & [street prefix] & " " & [street name]) & Chr(13) & Chr(10) &
Trim([suburb] & " " & [state] & " " & [pcode]))

What I would like is when there is no Unit/Flat, that the line space will be
closed up.

Could someone please advise how this can be achieved?

Many thanks

  #4  
Old February 8th, 2009, 10:11 PM posted to microsoft.public.access.gettingstarted
Ken Sheridan
external usenet poster
 
Posts: 3,433
Default Mailing Address

Try this (all as a single line). Because Null propagates in arithmetical
expressions the use of the + operator rather than the & concatenation
operator within the parenthesized expression will suppress the space and
carriage return/linefeed:

= Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10)
& Trim(([unit/flat] + " " + [unit/flat no]+ Chr(13) + Chr(10)) & ([street
number] & "" & [street prefix] & " " & [street name]) & Chr(13) & Chr(10) &
Trim([suburb] & " " & [state] & " " & [pcode]))

Ken Sheridan
Stafford, England

"Roger Bell" wrote:

I have a text box on a Report as follows:

=Trim([titles] & " " & [Firstname]) & " " & [Lastname] & Chr(13) & Chr(10) &
Trim([unit/flat] & " " & [unit/flat no] & Chr(13) & Chr(10) & "" & ([street
number] & "" & [street prefix] & " " & [street name]) & Chr(13) & Chr(10) &
Trim([suburb] & " " & [state] & " " & [pcode]))

What I would like is when there is no Unit/Flat, that the line space will be
closed up.

Could someone please advise how this can be achieved?

Many thanks


 




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 09:13 AM.


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