Solved

Access Control Textbox to go to a second line (carriage return) iif(isnull(variable)=False)

Posted on 2013-01-08
6
611 Views
Last Modified: 2013-01-08
Hello All
I have a query that gets the complete Street Address with Apt #  of Address Line 1 and also the complete Street Address with Apt # of Address Line 2. and then on a 3rd line the CSZ

Now what I want to do is to display that Line 1 and line 2 and Line 3 in a Control Textbox and IF Line 2 is not null show Line 2 on a new line and if Line 3 is not null show it on a new line.

Right now in my control source I have

=[AddrL1] & Chr(10) & Chr(13) & IIf(IsNull([AddrL2])=False,[AddrL2]) & Chr(10) & Chr(13) & iif(ixnull([CSZ])=false,[CSZ])

I also tried it as
=[AddrL1] & IIf(IsNull([AddrL2])=False, & Chr(10) & Chr(13)&[AddrL2]) & iif(ixnull([CSZ])=false,& Chr(10) & Chr(13)&[CSZ])


Is there a different way to do that instead of chr(10) & chr(13)  right now those aren't working in my situation
0
Comment
Question by:wlwebb
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 38754958
Your syntax is a little off.  Try this:


=[AddrL1] & IIf(IsNull([AddrL2])=False, Chr(10) & Chr(13) & [AddrL2], "") &  IIf(IsNull([CSZ])=False, Chr(10) & Chr(13) & [CSZ], "")

Open in new window

0
 
LVL 40

Expert Comment

by:als315
ID: 38754960
May be better to set it to:
=[AddrL1] & IIf(IsNull([AddrL2]), "",Chr(10) & Chr(13) & [AddrL2]) & iif(isnull([CSZ]),"",& Chr(10) & Chr(13)&[CSZ])
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38754969
Also,  if you are dealing with a report, you can use separate textboxes for each line with the Can Shrink property of the textboxes set to true.  (This won't work on forms)

This works if you have no other controls in horizontal alignment with these textboxes.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:wlwebb
ID: 38755059
Als315  I keep getting a Syntax error with that code

Mbiz.  shows all the info just doesn't go to a new line when I display the Form.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38755075
try this


=[AddrL1] & IIf(IsNull([AddrL2])=False, Chr(13) & Chr(10) & [AddrL2], "") &  IIf(IsNull([CSZ])=False, Chr(13) & Chr(10) & [CSZ], "")
0
 

Author Closing Comment

by:wlwebb
ID: 38755087
That was it Cap1
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question