How to go to new line in code "String"

B

Barry

Hi,
i am writing code in VB to send an email to a distribution list which will
then send an email including information that has just been entered in the
event log.

DoCmd.SendObject acReport, "EVENT - Email job event",
"SnapshotFormat(*.snp)", "LIS", "", , "Event for" & " " &
Forms![EventLog]![chrJobname], Forms![EventLog]![chrJobNoID] _
& Forms![EventLog]![chrJobAddress], False

My problem here is that i want to place information about the job in the
message text of the email but i can not go to a new line in the text. I can
only get the text to read straight accross one line. I need to go to new
lines for the job address

Can anyone help me as this has been plaguing me for weeks now? thanks in
advance....
 
O

Ofer

I can't try it now, before I'm posting that, but try to add chr(13) where you
want the new line to start

"My message start here" & chr(13) & "and start a new line"
 
B

Barry

Thanks that worked great, my only problem now is that the code is so long in
the VB window so i have to scroll to read it all. I know you can use the "_"
in the code to go to a new line of code but im not sure exactly how this
works. Can you help me

Ofer said:
I can't try it now, before I'm posting that, but try to add chr(13) where you
want the new line to start

"My message start here" & chr(13) & "and start a new line"
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Barry said:
Hi,
i am writing code in VB to send an email to a distribution list which will
then send an email including information that has just been entered in the
event log.

DoCmd.SendObject acReport, "EVENT - Email job event",
"SnapshotFormat(*.snp)", "LIS", "", , "Event for" & " " &
Forms![EventLog]![chrJobname], Forms![EventLog]![chrJobNoID] _
& Forms![EventLog]![chrJobAddress], False

My problem here is that i want to place information about the job in the
message text of the email but i can not go to a new line in the text. I can
only get the text to read straight accross one line. I need to go to new
lines for the job address

Can anyone help me as this has been plaguing me for weeks now? thanks in
advance....
 
O

Ofer

Example

Dim MyStr as String

MyStr = "Start of string " & _
"Continue of string " & chr(13) & _
"continue in a new line " & _
"continue second line and end of string"
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Barry said:
Thanks that worked great, my only problem now is that the code is so long in
the VB window so i have to scroll to read it all. I know you can use the "_"
in the code to go to a new line of code but im not sure exactly how this
works. Can you help me

Ofer said:
I can't try it now, before I'm posting that, but try to add chr(13) where you
want the new line to start

"My message start here" & chr(13) & "and start a new line"
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Barry said:
Hi,
i am writing code in VB to send an email to a distribution list which will
then send an email including information that has just been entered in the
event log.

DoCmd.SendObject acReport, "EVENT - Email job event",
"SnapshotFormat(*.snp)", "LIS", "", , "Event for" & " " &
Forms![EventLog]![chrJobname], Forms![EventLog]![chrJobNoID] _
& Forms![EventLog]![chrJobAddress], False

My problem here is that i want to place information about the job in the
message text of the email but i can not go to a new line in the text. I can
only get the text to read straight accross one line. I need to go to new
lines for the job address

Can anyone help me as this has been plaguing me for weeks now? thanks in
advance....
 
B

Barry

Thanks Ofer

Ofer said:
Example

Dim MyStr as String

MyStr = "Start of string " & _
"Continue of string " & chr(13) & _
"continue in a new line " & _
"continue second line and end of string"
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Barry said:
Thanks that worked great, my only problem now is that the code is so long in
the VB window so i have to scroll to read it all. I know you can use the "_"
in the code to go to a new line of code but im not sure exactly how this
works. Can you help me

Ofer said:
I can't try it now, before I'm posting that, but try to add chr(13) where you
want the new line to start

"My message start here" & chr(13) & "and start a new line"
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



:

Hi,
i am writing code in VB to send an email to a distribution list which will
then send an email including information that has just been entered in the
event log.

DoCmd.SendObject acReport, "EVENT - Email job event",
"SnapshotFormat(*.snp)", "LIS", "", , "Event for" & " " &
Forms![EventLog]![chrJobname], Forms![EventLog]![chrJobNoID] _
& Forms![EventLog]![chrJobAddress], False

My problem here is that i want to place information about the job in the
message text of the email but i can not go to a new line in the text. I can
only get the text to read straight accross one line. I need to go to new
lines for the job address

Can anyone help me as this has been plaguing me for weeks now? thanks in
advance....
 
D

Douglas J Steele

Actually, VBA normally requires that you use both Chr(13) (carriage return)
AND Chr(10) (line feed), in that order. Alternatively, in code (i.e.: not in
queries), you can use the intrinsic constant vbCrLf

"My message start here" & chr(13) & chr(10) & _
"and start a new line"

or

"My message start here" & vbCrLf & _
"and start a new line"


--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ofer said:
I can't try it now, before I'm posting that, but try to add chr(13) where you
want the new line to start

"My message start here" & chr(13) & "and start a new line"
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benefit from it.

Good luck



Barry said:
Hi,
i am writing code in VB to send an email to a distribution list which will
then send an email including information that has just been entered in the
event log.

DoCmd.SendObject acReport, "EVENT - Email job event",
"SnapshotFormat(*.snp)", "LIS", "", , "Event for" & " " &
Forms![EventLog]![chrJobname], Forms![EventLog]![chrJobNoID] _
& Forms![EventLog]![chrJobAddress], False

My problem here is that i want to place information about the job in the
message text of the email but i can not go to a new line in the text. I can
only get the text to read straight accross one line. I need to go to new
lines for the job address

Can anyone help me as this has been plaguing me for weeks now? thanks in
advance....
 
Top