Solved

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

Posted on 2011-03-20
4
315 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
Comment Utility
try

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

Accepted Solution

by:
Rey Obrero earned 350 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

763 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

6 Experts available now in Live!

Get 1:1 Help Now