How to go to new line in code "String"

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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....
 
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"
 
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....
 
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....
 
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....
 
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....
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top