Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Moving contents of Memo field into e-mail body

Status
Not open for further replies.

TechieJr

Instructor
Nov 13, 2002
71
CA
Good Day All,

As part of my current db project, I have a msg form which our receptionist completes and then e-mails to the intended recipient. It was working fine until I had to change the msg field from a text field to a memo field (255 characters was not enough for some msgs). Now, anything entered in the msg field is not transferred to the body of the e-mail. I have checked field names, vbcode, etc. but can't figure out what the problem is.

Can anyone shed some light on this for me?

Thanks muchly,

TechieJr.
 
TechieJr - can you paste the code that is casuing the problem to this post?
 
Good Morning,

Here's the code Simon asked for. This worked great when the Comment field was a text field type in the table. When I changed the field type to Memo, whatever was entered into this field ceased being copied to the e-mail message this code invokes. (I think I've highlighted all the lines which are involved in red.)

Let me know if I can answer any further questions.

TechieJr.

Code:
Private Sub Command47_Click()
    Dim CallerName As String, Comp As String, BusPh As String, Called As String, _
    contype As String, FolUp As String, [COLOR=red]Note As String,[/color] WhenD As String, WhenT As String
    Dim objOutlook As Outlook.Application
    Dim objEmail As Outlook.MailItem
        
    CallerName = Forms![f_DaylogEntry]!Combo10.Column(1)
    Comp = Nz(Forms![f_DaylogEntry]!Company, "No company")
    BusPh = Nz(Forms![f_DaylogEntry]!BusPhone, "No phone")
    Called = Me!CalledFor.Column(1)
    [COLOR=red]Note = Nz(Me!Comment, "No message")[/color]
    WhenD = Me!NewDate
    WhenT = Me!NewTime
               
    Select Case Me!ContactType
    Case 3
        contype = "Visitor came to see"
    Case 2
        contype = "Came for meeting with"
    Case Else
        contype = "Phone call for"
    End Select
    
    Select Case Me!Action
    Case 4
        FolUp = "Returned your call."
    Case 3
        FolUp = "Will call back."
    Case 2
        FolUp = "Please call."
    Case Else
        FolUp = "No action required."
    End Select
       
    Set objOutlook = CreateObject("Outlook.application")
    Set objEmail = objOutlook.CreateItem(olMailItem)
        
    With objEmail
        .To = Called
        .Subject = contype & " " & Called
        .Body = CallerName & " of " & Comp & " (" & BusPh & ") " & Chr(13)
        .Body = .Body & "At " & WhenT & " on " & WhenD & Chr(13)
        .Body = .Body & FolUp & Chr(13)
        [COLOR=red].Body = .Body & Note[/color]
        .Display
    End With
    
    Set objEmail = Nothing
    
    Me!CalledFor.SetFocus
    Forms![f_DaylogEntry]!Combo10.SetFocus
    
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top