Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

How to go to new line in code "String"

Discussion in 'Information Technology' started by Barry, Nov 4, 2005.

  1. Barry

    Barry
    Expand Collapse
    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....
     
  2. Loading...

    Similar Threads Forum Date
    Khalsa Aid The Selfless Sikh Faith On The Frontline, A Documentary By BBC 2016 Sikh Organisations Nov 16, 2016
    Sikh News Veteran Sikh Soldiers To Inspire Young - Malay Mail Online Breaking News Aug 1, 2016
    Hard Talk Confused Islamophobes Target American Sikhs Online Hard Talk Apr 26, 2016
    Is There A Thin Line Between Love And Hate? Interfaith Dialogues Apr 25, 2016
    Hard Talk Taking One Liners Out Of Context From Gurbani To Allow Intellectual Independence? Hard Talk Apr 23, 2016

  3. Ofer

    Ofer
    Expand Collapse
    Guest

    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" wrote:

    > 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....
     
  4. Barry

    Barry
    Expand Collapse
    Guest

    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" wrote:

    > 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" wrote:
    >
    > > 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....
     
  5. Ofer

    Ofer
    Expand Collapse
    Guest

    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" wrote:

    > 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" wrote:
    >
    > > 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" wrote:
    > >
    > > > 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....
     
  6. Barry

    Barry
    Expand Collapse
    Guest

    Thanks Ofer

    "Ofer" wrote:

    > 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" wrote:
    >
    > > 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" wrote:
    > >
    > > > 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" wrote:
    > > >
    > > > > 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....
     
  7. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    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
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Ofer" <Ofer@discussions.microsoft.com> wrote in message
    news:C91520B7-835C-44FE-9B8D-6E26E16CE504@microsoft.com...
    > 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" wrote:
    >
    > > 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....
     

Share This Page