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

Support for Office 2003 has ended

Microsoft ended support for Office 2003 on April 8, 2014. This change has affected your software updates and security options. Learn what this means for you and how to stay protected.

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.
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
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 "NOTICE:" & vbCrLf & "This is an Important Message!"					
  • Example Using the Character Codes:
    MsgBox "NOTICE:" & Chr(13) & Chr(10) & "This is an Important Message!"					
You can also use the vbCrLf constant to create multiple lines in a text box on a form or on a data access page.
For more information about character codes, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type Chr function in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
kbnoOfficeAlertID OfficeKBHowTo multiline inf next new line break linebreak ACC2002 ACC2003 ACC2007 reviewdocid

Article ID: 281670 - Last Review: 03/28/2007 18:25:38 - Revision: 7.1

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

  • kbprogramming kbhowto KB281670