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


Office 365 ProPlus is being renamed to Microsoft 365 Apps for enterprise. For more information about this change, read this blog post.

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.


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 vbCrLfconstant 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.