Results 1 to 7 of 7
  1. #1
    Join Date
    Oct 2004
    Location
    Tunbridge Wells, Kent. UK
    Posts
    24

    Unanswered: & vbCrLf & - not working!

    I am sending a Message as part of an email using .SendObject. I want the message over a number of lines. I have used the vbCrLf command, but it does not seem to work! Below is the expression.

    Can you see anything wrong with this? Can you use this CR command in the middle of a string of literal text?


    DoCmd.SendObject acReport, "Fixtures", "RichTextFormat(*.rtf)", "", "", "", "blah", "blah blah" & vbCrLf & "blah blah" & vbCrLf & "blah blah" & vbCrLf & "blah blah" & vbCrLf & "blah blah", True, ""


    Thanks, Matt

  2. #2
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    Just shootin' from the hip here (whatever that means), but it works for me if I put the "blah blah" & vbCrLf & "blah blah" & vbCrLf etc...bit into a string first. so
    Code:
    strTemp = "blah blah" & vbCrLf & "blah blah" & vbCrLf & ""
    
    DoCmd.SendObject acReport, "Fixtures", "RichTextFormat(*.rtf)", "", "", "", "blah", strTemp, True, ""
    that oughtta do you right...

  3. #3
    Join Date
    Oct 2004
    Location
    Tunbridge Wells, Kent. UK
    Posts
    24
    too bizarre. It still doesn't work!

    Private Sub Run_Fixture_Confirmation_Click()
    On Error GoTo Run_Fixture_Confirmation_Err

    strMessage = "Fixture confirmations attached." & vbCrLf & "Please confirm all OK and provide times for those games at your ground." & vbCrLf & "ALL FIXTURES CAN BE CHECKED AT www.twhc.co.uk" & vbCrLf & "Cheers, Matt Cawsey" & vbCrLf & "Fixture Secretary, Tunbridge Wells Hockey Club" & vbCrLf & "01892 533021" & vbCrLf & "07765 226842"
    DoCmd.OutputTo acQuery, "Email addresses", "MicrosoftExcelBiff8(*.xls)", "C:\EMAILS.XLS", True, "", 0
    DoCmd.SendObject acReport, "Fixtures Query By Date", "RichTextFormat(*.rtf)", "", "", "", "Tunbridge Wells HC - Forthcoming Fixtures", strMessage, True, ""
    DoCmd.Close acForm, "Date Entry"

  4. #4
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    here's what I used in one project:
    Code:
    strMessage = "Julia, " & vbLf & "   Good morning. I don't know if this even an issue, but I inadvertently " & _
        "found a way through Microsoft Access to ...without their " & _
        "permission (if they open a database or form). That's actually how I sent this message. " & _
        "Like I said, it may not even be an issue, but I just wanted to let someone know. Thanks," & vbLf & vbLf & _
        "v/r" & vbLf & "Justin"
        
        DoCmd.SendObject acSendTable, "tblTemp", acFormatRTF, , "Justin@somedomain.com", , "IT Security?", strMessage, False
    This worked for me. Maybe try taking out the ""s in those places where that's all you have between commas. Finally, what exactly is the error it gives you?

  5. #5
    Join Date
    Oct 2004
    Location
    Tunbridge Wells, Kent. UK
    Posts
    24
    I don't get any error message. It compiles and runs just fine, just when the email is created, the whole message is one long string without the line breaks!

  6. #6
    Join Date
    Apr 2004
    Location
    Kingsland, Georgia
    Posts
    231
    Here's exactly what I just used (with the email address changed), and it works perfectly on my machine:
    Code:
    strMessage = "Fixture confirmations attached." & vbCrLf & "Please confirm all OK and provide times for those games at your ground." & vbCrLf & "ALL FIXTURES CAN BE CHECKED AT www.twhc.co.uk" & vbCrLf & "Cheers, Matt Cawsey" & vbCrLf & "Fixture Secretary, Tunbridge Wells Hockey Club" & vbCrLf & "01892 533021" & vbCrLf & "07765 226842"
    DoCmd.SendObject acSendReport, "rptInstalls", acFormatRTF, "myemail@domain.com", , , "Test", strMessage, True
    sorry if this doesn't work, bro. i'm all out. have a great weekend.

  7. #7
    Join Date
    Oct 2004
    Location
    Tunbridge Wells, Kent. UK
    Posts
    24
    Finally got it working! Thanks so much for your help. Have a beer on me this weekend

    For some really odd reason I had to put DOUBLE carriage returns in!!

    ...." & vbCrLf & vbCrLf & "....

    Truth is stranger than fiction! Cheers, Matt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •