Sending Microsoft Access Email Blasts Programmatically (VBA)
The add-in Wizard in Total Access Emailer lets you
interactively create the email blasts you want to send from
Microsoft Access.
In the Professional Version, Total Access Emailer
offers a VBA programmatic interface that lets you run these
email blasts from your MS Access code. This can be tied to an event (for
instance, a
button click), a macro via the RunCode action, or within
your other VBA processes.
The nice thing is the complexity of creating, specifying
all the options, and
testing/previewing the email blast can be done
interactively through the add-in, and you simply launch it
in your code.
Programmatic Interface for Sending Emails from Microsoft
Access
By adding Total Access Emailer's royalty-free runtime distribution file
as a library reference to your project, you can invoke its procedure. Any email blast created by the add-in can be added to your
application with a simple function call. Each email blast is
given a number. In this example, email blast #25 is sent:
strError = TotalAccessEmailer(25, False, "", "", True, True)
That's all you need to add the sophisticated email
features of Total Access Emailer into your applications. The
user interface can be completely hidden so your users don't
even realize Total Access Emailer is running in the
background. You control your user's experience.
Procedure Definition
Public Function TotalAccessEmailer( _
lngEmailID As Long, _
fRestartBlast As Boolean, _
strDisplayType As String, _
strDisplayTitle As String, _
fShowResults As Boolean, _
fShowErrors As Boolean, _
Optional strEmailTbl As String, _
Optional strOptionsTbl As String, _
Optional strEmbedTbl As String) _
As String
Procedure Parameters
These parameters are
available to customize how your email blast is sent. You can choose to have
Total Access Emailer display its progress screens with your
title, or hide it completely from your user.
| Parameter |
Definition |
| lngEmailID |
The ID of the email blast to send |
| fRestartBlast |
True to restart the email blast if it stopped,
or False to start it from the beginning. |
| strDisplayType |
Choose whether and how to display the progress
of the email blast to the user (form or status bar)
|
| strDisplayTitle |
The title for the display form and messages to
avoid "Total Access Emailer" from appearing. |
| fShowResults |
True shows the email blast results in a message
box when completed. |
| fShowErrors |
True displays the errors table if errors are
encountered. False still generates the errors table,
but does not display it. |
Optional Parameters
By default, the function uses the email blasts stored in
the three tables used by the add-in. When you add email
blasts to your application, you may not want users to be
able to edit them with their add-in. By renaming these
tables, you can ensure they are not modified. Simply pass
the names of your tables as the optional parameters and the
function looks there for the email blast specifications.
| Parameter |
Definition |
| strEmailTbl |
The table in the database containing the email
blast settings. The default value is "usysTEmailerSettings". |
| strOptionsTbl |
The table in the database containing the Send
and SMTP options. The default value is "usysTEmailerOptions". |
| strEmbedTbl |
The table in the database containing the
Embedded Object information. The default value is "usysTEmailerEmbedded". |
Return Value
The function returns a blank string if it's successful or an error string
if there's a problem. You can choose to display that to the user or hide it
and process it yourself.
Library Reference for Adding Microsoft Access Emails
To use the Total Access Emailer function, add Total
Access Emailer as a library reference from your VBA Tools, Reference
menu:

The Total Access Emailer library includes runtime distribution
rights so you can distribute your Microsoft Access application using
Total Access Emailer royalty-free to non-owners of Total Access
Emailer. This example shows the version for Microsoft Access 2007.
Versions are available to support Microsoft Access 2003, 2002, 2000,
and 97.
Table Driven Email Systems
With the programmatic interface, you can easily add table driven emailing
systems within your Microsoft Access applications. More details in
Creating a Continuous Email Service in
Microsoft Access.
Main Total Access Emailer Page