working with msgbox

  • Thread starter Thread starter Karen
  • Start date Start date
K

Karen

I'm writting message box prompts and on some of them I'd like to break the
line. Access help says
If prompt consists of more than one line, you can separate the lines using a
carriage return character (Chr(13)), a linefeed character (Chr(10)), or
carriage return - linefeed character combination (Chr(13) & Chr(10)) between
each line.

But how do I enter the CHR(13) etc in the prompts? What should they look
like?

Karen
 
MsgBox "This is line one" & Chr$(13) & "This is line two"

In VBA code, you can also use the intrinsic constants vbCr, vbLf, and vbCrLf
....

MsgBox "This is line one" & vbCrLf & "This is line two"

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Hi Karen,

Either of these should work just fine for you:

MsgBox "This is the first line." _
& Chr(13) & Chr(10) _
& "This is the second line."

MsgBox "This is the first line." _
& vbNewLine _
& "This is the second line."
 
Karen said:
I'm writting message box prompts and on some of them I'd like to break the
line. Access help says
If prompt consists of more than one line, you can separate the lines using a
carriage return character (Chr(13)), a linefeed character (Chr(10)), or
carriage return - linefeed character combination (Chr(13) & Chr(10)) between
each line.
Take your pick:

MsgBox "Line of Text" & Chr(13) & "Another Line"
MsgBox "Line of Text" & Chr(13) + Chr(10) & "Another Line"

or use the VB Constants vbCr or vbCrlf:

MsgBox "Line of Text" & vbCr & "Another Line"
MsgBox "Line of Text" & vbCrLf & "Another Line"
 
Thanks to everyone who answered my question! What a great group of
professionals to have around to get help from.

K-
 
Back
Top