Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Send email via ACCESS 1

Status
Not open for further replies.

MaxEd

Technical User
Jul 3, 2002
407
0
0
US
I am trying to setup a database that sends out an email every thursday to a participants from a list. It should pick from the last record and repeated every thursday. I can't use outlook for those of you who know how to do it using Outlook. Thank you.
 
From Access97 Help:

The SendObject method carries out the SendObject action in Visual Basic. For more information on how the action and its arguments work, see the action topic.

Syntax

DoCmd.SendObject [objecttype][, objectname][, outputformat][, to][, cc][, bcc][, subject][, messagetext][, editmessage][, templatefile]

The SendObject method has the following arguments.

Argument Description

objecttype One of the following intrinsic constants:
acSendForm
acSendModule
acSendNoObject (default)
acSendQuery
acSendReport
acSendTable
objectname A string expression that's the valid name of an object of the type selected by the objecttype argument. If you want to include the active object in the mail message, specify the object's type with the objecttype argument and leave this argument blank. If you leave both the objecttype and objectname arguments blank (the default constant, acSendNoObject, is assumed for the objecttype argument), Microsoft Access sends a message to the electronic mail application without an included database object.
If you run Visual Basic code containing the SendObject method in a library database, Microsoft Access looks for the object with this name first in the library database, then in the current database.
outputformat One of the following intrinsic constants:
acFormatHTML
acFormatRTF
acFormatTXT
acFormatXLS
If you leave this argument blank, Microsoft Access prompts you for the output format.
to A string expression that lists the recipients whose names you want to put on the To line in the mail message.
Separate the recipient names you specify in this argument and in the cc and bcc arguments with a semicolon (;) or with the list separator set on the Number tab of the Regional Settings Properties dialog box in Windows Control Panel. If the recipient names aren't recognized by the mail application, the message isn't sent.
If you leave this argument blank, Microsoft Access prompts you for the recipients.
cc A string expression that lists the recipients whose names you want to put on the Cc line in the mail message. If you leave this argument blank, the Cc line in the mail message is blank.
bcc A string expression that lists the recipients whose names you want to put on the Bcc line in the mail message. If you leave this argument blank, the Bcc line in the mail message is blank.
subject A string expression containing the text you want to put on the Subject line in the mail message. If you leave this argument blank, the Subject line in the mail message is blank.
messagetext A string expression containing the text you want to include in the body of the mail message, after the object. If you leave this argument blank, the object is all that's included in the body of the mail message.
editmessage Use True (–1) to open the electronic mail application immediately with the message loaded, so the message can be edited. Use False (0) to send the message without editing it. If you leave this argument blank, the default (True) is assumed.
templatefile A string expression that's the full name, including the path, of the file you want to use as a template for an HTML file.
Remarks

Modules can be sent only in MS-DOS Text format, so if you specify acSendModule for the objecttype argument, you must specify acFormatTXT for the outputformat argument.
You can leave an optional argument blank in the middle of the syntax, but you must include the argument's comma. If you leave a trailing argument blank, don't use a comma following the last argument you specify.

Example:

DoCmd.SendObject acSendTable, "Employees", acFormatXLS, _
"Nancy Davolio; Andrew Fuller", "Joan Weber", , _
"Current Spreadsheet of Employees", , False

You can send a preformatted message this way without needing to open Outlook.

Good LucK!

 
As a followup, I would suggest setting up variables for all of the pieces noted above. Define all non-boolean variables as variants because the value needs to be empty if not specified for some of them.

Have a great daY!

 
SBendBuckeye,

I am not familiar with how this function works so how does Access enable itself to send an email without using a client software?
 
As far as I know SendObject uses the default e-mail client. If it doesn't give you enough functionality then there may well be another way of doing it, I've only used Outlook myself, but there's certainly been post on a couple of others.

Sharon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top