Solved

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

Posted on 2011-03-20
4
316 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
  • 2
  • 2
4 Comments
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 350 total points
ID: 35177490
try

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

Accepted Solution

by:
Rey Obrero earned 350 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 150 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
MS Access 2016 Debugging 7 41
ms/access ftp / SFTP 3 32
Storing Combo Box Selection in Table 12 41
MS Access Order Smallest to Biggest Query Help 13 39
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

948 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now