Solved

Emailing a form as plain text.

Posted on 2009-05-05
4
646 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Familiarize people with the process of utilizing SQL Server views 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 Microsoft Access…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now