Body of EMail

mike60smart

Registered User.
Local time
Today, 06:56
Joined
Aug 6, 2017
Messages
1,991
Hi Everyone

Is it possible to have a table named "tblAgentEmailDefaults" with a specific field named "MsgBody"

Then in the on Click Event to send the email, be able insert into the Code this specific field by using a DLookup or anything similar?

Any help appreciated
 
Is there only one record in tblAgentEmailDefaults?
In that case simply use:
Code:
DLookup("MsgBody", "tblAgentEmailDefaults")
If not, you need to add a condition.
 
It might get tricky. People have reported issues with long text sequences and the Domain Aggregate functions. Using a recordset, even a Long Text field shouldn't be a problem, but remember that a Short Text field has a 255 character limit. Also remember that a message body normally includes any formal signatures unless you add one in as a template.
 
Hi Doc Man

I have posted a follow - on for this Here

Where I am trying to add additional lines within the body of the email
 
When I did this in the past, I ALWAYS ALWAYS ALWAYS created an empty strBody string variable and started concatenating parts one at a time, then when I was done, it was ready to be used directly. The advantage is that I could debug it with a breakpoint and single-step and then use either the mouse cursor or a DEBUG.PRINT to the Immediate window. I could add as much as I wanted within a fairly broad range and the mail messages always came out just fine. Easier to debug, too.
 
Hi Everyone

Is it possible to have a table named "tblAgentEmailDefaults" with a specific field named "MsgBody"

Then in the on Click Event to send the email, be able insert into the Code this specific field by using a DLookup or anything similar?

Any help appreciated
Of course it's possible to look it up, but not to literally "insert into the Code", unless you're using extensibility. That'd be editing code.
 
You can use "placeholders" in your default body (I usually use pipe-delimited ones as it is a fairly uncommon character) then use nested Replace() functions to insert the actual values from your form:
strBody=Replace(Replace(strBody,"|SALARY|",[Forms]![AccountingSub]![PayAgentCommSub].[Form]![txtSal]),"|FROM|"[Forms]![AccountingSub]![PayAgentCommSub].[Form]![txtFrom])) 'the original strBody is retrived by your dLookup,

Cheers,
 
You can use "placeholders" in your default body (I usually use pipe-delimited ones as it is a fairly uncommon character) then use nested Replace() functions to insert the actual values from your form:
strBody=Replace(Replace(strBody,"|SALARY|",[Forms]![AccountingSub]![PayAgentCommSub].[Form]![txtSal]),"|FROM|"[Forms]![AccountingSub]![PayAgentCommSub].[Form]![txtFrom])) 'the original strBody is retrived by your dLookup,

Cheers,
Hi Vlad

Many thanks I used this method and it works
 

Users who are viewing this thread

Back
Top Bottom