How to add a line-continuation character in MS Access VB

  • Thread starter Thread starter TomP
  • Start date Start date
T

TomP

I a MsgBox with a long message. Rather having one long statement in one
line, I want to continue to the next line. I tried to include a space
followed by an underscore would work.

It works for VB Express, but for some reason MS Access XP in VB mode is a
little different?

Thank you for your help!
 
To use multiple lines in a message box, use the vbNewLine constant.

MsgBox "This will be on line 1" & vbNewLine & "This will be on line 2"
 
Hi Tom,
"this is line one" _
& vbCrLf _
& "this is line two"

The space plus underscore tells Access to join what is on the first line
with the second line to make one long line.

Jeanette Cunningham
 
I a MsgBox with a long message. Rather having one long statement in one
line, I want to continue to the next line. I tried to include a space
followed by an underscore would work.

It works for VB Express, but for some reason MS Access XP in VB mode is a
little different?

Thank you for your help!

Well, the line continuation characters ARE the space and underscore,
so if it didn't 'work' (whatever that means), it's likely that you
incorrectly did it. Wouldn't have been more helpful to you to have
included in your message your actual code, and what error occurred
when you ran it, so that we could see what you did?
 
I a MsgBox with a long message.  Rather having one long statement in one
line, I want to continue to the next line.  I tried to include a space
followed by an underscore would work.  

It works for VB Express, but for some reasonMSAccessXP in VB mode is a
little different?

Thank you for your help!

Another option, one I use all the time, is to display your message
using the constants vbcr (carriage return). Example:
Msgbox "Removing a client will also remove" & vbcr & "all orders on
file, and this" & vbcr & "action cannot be undone!"
This would display a message like this:

Removing a client will also remove
all order on file, and this
action cannot be undone!

Milton
 
Thank you for your help, it worked! :-)

Jeanette Cunningham said:
Hi Tom,
"this is line one" _
& vbCrLf _
& "this is line two"

The space plus underscore tells Access to join what is on the first line
with the second line to make one long line.

Jeanette Cunningham
 
Back
Top