Messagebox with go to next line

J

JOM

I want my messagebox to say the following how will I do it?
*******************************************
Please see me regarding the use of
"INTERNET"

If I agreed press Yes
if I did not agree press No

***************************************
I want it to appear as it is
 
O

Ofer

Try this

MsgBox "Please see me regarding the use of " & Chr(10) & _
"INTERNET" & Chr(10) & Chr(10) & _
" If I agreed press Yes" & Chr(10) & _
"if I did not agree press No"
 
J

JOM

Thanks alot that worked

Ofer said:
Try this

MsgBox "Please see me regarding the use of " & Chr(10) & _
"INTERNET" & Chr(10) & Chr(10) & _
" If I agreed press Yes" & Chr(10) & _
"if I did not agree press No"

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
J

JOM

I have a question though about the line, I have that code in the before
update procedure, I would like when the user presses yes to go to the next
field, how will do that?
 
O

Ofer

You can use that
Me.FieldName.SetFocus
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
J

JOM

I tried doing that but its gviving me a runtime error 2108 "You must save the
field before you execute the GoToControl action, the GoToControl Method, or
the setFocus methods

response = MsgBox ("Please see me regarding the use of " & Chr(10) & _
"INTERNET" & Chr(10) & Chr(10) & _
" If I agreed press Yes" & Chr(10) & _
"if I did not agree press No",vbyesno)

if response = vbno then
cancel= true
else
cancel = false
me.reasons.setfocus
end if




....
 
O

Ofer

On the before update have that
response = MsgBox ("Please see me regarding the use of " & Chr(10) & _
"INTERNET" & Chr(10) & Chr(10) & _
" If I agreed press Yes" & Chr(10) & _
"if I did not agree press No",vbyesno)

if response = vbno then
cancel= true
end if

On the after update have that

me.reasons.setfocus
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
K

Ken Snell [MVP]

Better to use Chr(13) & Chr(10):

MsgBox "Please see me regarding the use of " & Chr(13) & Chr(10) & _
"INTERNET" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
" If I agreed press Yes" & Chr(13) & Chr(10) & _
"if I did not agree press No"

Or, use vbCrLf in place of the Chr(13) & Chr(10) combination.
 
D

Dirk Goldgar

Ken Snell said:
Better to use Chr(13) & Chr(10):

MsgBox "Please see me regarding the use of " & Chr(13) & Chr(10) & _
"INTERNET" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
" If I agreed press Yes" & Chr(13) & Chr(10) & _
"if I did not agree press No"

Or, use vbCrLf in place of the Chr(13) & Chr(10) combination.

I don't see why that's better, Ken. Although I was surprised that
Ofer's suggestion of using Chr(10) worked, it's documented that Chr(13)
alone -- or vbCr -- is accepted as a line break by the MsgBox function.
That being so, I habitually use vbCr alone in breaking up MsgBox text,
and have never had any problem come from it.

True, you can't do the same with text in a text box, or label
captions -- for them you have to have both the CR and the LF in
combination -- but as long as you know that MsgBox is different, why
bother using both control characters?
 
K

Ken Snell [MVP]

My suggestion is aimed at avoiding confusion by using different combinations
of these characters in different places in the database -- the Chr(10) won't
work for a new line in all cases. Perhaps a bit of "overstandardization" on
my part, but it's easier for me (and perhaps others?) to remember one
syntax.... < g >

--

Ken Snell
<MS ACCESS MVP>
 
J

JOM

Thanks, that solved the problem!

Ofer said:
On the before update have that
response = MsgBox ("Please see me regarding the use of " & Chr(10) & _
"INTERNET" & Chr(10) & Chr(10) & _
" If I agreed press Yes" & Chr(10) & _
"if I did not agree press No",vbyesno)

if response = vbno then
cancel= true
end if

On the after update have that

me.reasons.setfocus
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck
 
J

JOM

Thanks for the reply

Ken Snell said:
Better to use Chr(13) & Chr(10):

MsgBox "Please see me regarding the use of " & Chr(13) & Chr(10) & _
"INTERNET" & Chr(13) & Chr(10) & Chr(13) & Chr(10) & _
" If I agreed press Yes" & Chr(13) & Chr(10) & _
"if I did not agree press No"

Or, use vbCrLf in place of the Chr(13) & Chr(10) combination.
 
Top