Solved

Emailing a form as plain text.

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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

In Debugging – Part 1, you learned the basics of the debugging process. You learned how to avoid bugs, as well as how to utilize the Immediate window in the debugging process. This article takes things to the next level by showing you how you can us…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Familiarize people with the process of utilizing SQL Server functions 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 Ac…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

758 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

19 Experts available now in Live!

Get 1:1 Help Now