Microsoft KB Archive/281670

= How to force a new line in a MsgBox message in Access =

Article ID: 281670

Article Last Modified on 3/28/2007

-

APPLIES TO


 * Microsoft Office Access 2007
 * Microsoft Office Access 2003
 * Microsoft Access 2002 Standard Edition

-



This article was previously published under Q281670



Moderate: Requires basic macro, coding, and interoperability skills.

This article applies to either a Microsoft Access database (.mdb) file or to a Microsoft Access database (.accdb) file, and to a Microsoft Access project (.adp) file.For a Microsoft Access 2000 version of this article, see 209791.



SUMMARY
If you want to force a new line in a message box, you can include one of the following:
 * The Visual Basic for Applications constant for a carriage return and line feed, vbCrLf.
 * The character codes for a carriage return and line feed, Chr(13) & Chr(10).

For example, if you had the following message

NOTICE: This is an Important Message!

and you wanted the message to be displayed as

NOTICE:

This is an Important Message!

you would enter the message as a string expression as in either of the following examples:   Example Using the Visual Basic for Applications Constant: MsgBox &quot;NOTICE:&quot; & vbCrLf & &quot;This is an Important Message!&quot;   Example Using the Character Codes: MsgBox &quot;NOTICE:&quot; & Chr(13) & Chr(10) & &quot;This is an Important Message!&quot; 

You can also use the vbCrLf constant to create multiple lines in a text box on a form or on a data access page.

