Body of EMail (1 Viewer)

mike60smart

Registered User.
Local time
Today, 02:12
Joined
Aug 6, 2017
Messages
1,913
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
 

XPS35

Active member
Local time
Today, 03:12
Joined
Jul 19, 2022
Messages
160
Is there only one record in tblAgentEmailDefaults?
In that case simply use:
Code:
DLookup("MsgBody", "tblAgentEmailDefaults")
If not, you need to add a condition.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 20:12
Joined
Feb 28, 2001
Messages
27,227
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.
 

mike60smart

Registered User.
Local time
Today, 02:12
Joined
Aug 6, 2017
Messages
1,913
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
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 20:12
Joined
Feb 28, 2001
Messages
27,227
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.
 

Isaac

Lifelong Learner
Local time
Yesterday, 18:12
Joined
Mar 14, 2017
Messages
8,778
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.
 

bastanu

AWF VIP
Local time
Yesterday, 18:12
Joined
Apr 13, 2010
Messages
1,402
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,
 

mike60smart

Registered User.
Local time
Today, 02:12
Joined
Aug 6, 2017
Messages
1,913
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

Top Bottom