Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: How to Force a New Line in a MsgBox Message


View products that this article applies to.

Summary

If you want to force a new line in a message box, you can include either:
  • The Visual Basic for Applications Constant for a carriage return and line feed, vbCrLf.

    -or-
  • The character codes for a carriage return and line feed, Chr(13) & Chr(10).
For example, if you had the 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 "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 this technique to provide multiple lines in a text box on a form.

↑ Back to the top


References

For more information about character codes, click Microsoft Access Help on the Help menu, type Chr() in the Office Assistant or the Answer Wizard, and then click Search to view the topics returned.

↑ Back to the top


Keywords: KB209791, kbusage, kbhowto

↑ Back to the top

Article Info
Article ID : 209791
Revision : 4
Created on : 7/15/2004
Published on : 7/15/2004
Exists online : False
Views : 378