Solved

Emailing a form as plain text.

Posted on 2009-05-05
4
648 Views
Last Modified: 2013-11-28
I have some reports I email as plain text. Because of the size of the body I created a table with a memo field so I can reference the table and record to insert into the body for that particular form. How do I go about referencing the table and record that I want shown in the body of the email?

I would like to replace the text

"Your support request has been resolved - If you require additional action or have questions regarding this case please reply to this email with a detailed explanation."

with the value in the memo field from table "strings" record "1"
'------------------------------------------------------------
' cmdEmail_Click
'
'------------------------------------------------------------
Private Sub cmdEmail_Click()
On Error GoTo cmdEmail_Click_Err
 
    On Error Resume Next
    DoCmd.SendObject , "", "", DLookup("[E-mail Address]", "Users", "ID = " & Forms![Call Details]!Caller), "", "", Replace(Replace("Call |1: |2", "|1", Nz(ID, "")), "|2", Nz(Title, "")), IIf(Form.Description.TextFormat = 1, PlainText(Description), Description) + Chr(13) + Chr(10) + "Your support request has been resolved - If you require additional action or have questions regarding this case please reply to this email with a detailed explanation.", True, ""
    If (MacroError.Number <> 0) Then
        Beep
        MsgBox MacroError.Description, vbOKOnly, ""
    End If
 
 
cmdEmail_Click_Exit:
    Exit Sub
 
cmdEmail_Click_Err:
    MsgBox Error$
    Resume cmdEmail_Click_Exit
 
End Sub

Open in new window

0
Comment
Question by:timamartin
  • 3
4 Comments
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 24308446
timamartin

You did not specify two key pieces of info:
1. The Name of the field
2. The Specfic Criteria.

So try something like this.
It finds the Value in the "Strings" table in the "YourField" Field, Where the "Record" field is equal to 1
You will have to substitute the missing value for the ones I used ("YourTable" and "Record")


   DoCmd.SendObject , "", "", DLookup("[E-mail Address]", "Users", "ID = " & Forms![Call Details]!Caller), "", "", Replace(Replace("Call |1: |2", "|1", Nz(ID, "")), "|2", Nz(Title, "")), IIf(Form.Description.TextFormat = 1, PlainText(Description), Description) + Chr(13) + Chr(10) + DLookup("YourField", "Strings", "Record=" & 1), True, ""


JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24308449
Full string as well.
DoCmd.SendObject , "", "", DLookup("[E-mail Address]", "Users", "ID = " & Forms![Call Details]!Caller), "", "", Replace(Replace("Call |1: |2", "|1", Nz(ID, "")), "|2", Nz(Title, "")), IIf(Form.Description.TextFormat = 1, PlainText(Description), Description) + Chr(13) + Chr(10) + DLookup("YourField", "Strings", "Record=" & 1), True, ""

Open in new window

0
 

Author Comment

by:timamartin
ID: 24647433
This worked well -- thank you very much!
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 24650912
;-)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

808 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question