?
Solved

How do I add a line break in a report text box?

Posted on 2011-03-20
4
Medium Priority
?
321 Views
Last Modified: 2012-05-11
The ControlSource for the text box in my report is: =[strHorseBarnName] & IIf(Not IsNull([strHorseRegisteredName])," (" & [strHorseRegisteredName] & ")","")

How do I get the registered name to print in a line below the barn name (if it is NOT null)?

I tried  vbCrLf but that did not work.
0
Comment
Question by:bobbat
[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
  • 2
  • 2
4 Comments
 
LVL 120

Assisted Solution

by:Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1) earned 1400 total points
ID: 35177490
try

=[strHorseBarnName] & IIf(Not IsNull([strHorseRegisteredName]),Chr(13) & Chr(10) & "(" & [strHorseRegisteredName] & ")","")
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 1400 total points
ID: 35177748
or maybe this

=[strHorseBarnName] & IIf([strHorseRegisteredName] & ""<>"",Chr(13) & Chr(10) & "(" & [strHorseRegisteredName] & ")","")
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 600 total points
ID: 35179191
If these are text fields then you really need to be checking for empty strings ("")

Nulls are, (For lack of a simpler definition), irrelevant in string (text) fields in MS Access.

So, these worked fine for me:

=[strHorseBarnName] & IIf([strHorseRegisteredName]="","",Chr(13) & Chr(10) & [strHorseRegisteredName])

=[strHorseBarnName] & IIf(Len([strHorseRegisteredName])=0,"",Chr(13) & Chr(10) & [strHorseRegisteredName])

See here for more info:
http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/A_1910-Understanding-Null-Empty-Blank-N-A-ZLS-Nothing-Missing.html

;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 35179207
Or like this with the parenthesis:

=[strHorseBarnName] & IIf([strHorseRegisteredName]="","",Chr(13) & Chr(10) & "(" & [strHorseRegisteredName] & ")")

Or

=[strHorseBarnName] & IIf(Len([strHorseRegisteredName])=0,"",Chr(13) & Chr(10) & "(" & [strHorseRegisteredName] & ")")
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

719 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