hi:
As an example, the Function below, ABSendObject function, send a copy of a table, hard-coded as "Company," to the destination you set up. You'll need to provide a valid destination address in sRecipient. The name should be unique in your mail system to avoid MAPI needing to resolve the name when the message is sent.
If you do not specify a unique name, the Send Note dialog will be shown and you will have to specify the name to send the message to.
CODE
Function ABSendObject ()
'send an object, using MAPI, from Access to
'another system - this routine is hardcoded
'to send the company table.
Dim sRecipient As String
sRecipient = "Steve Wynkoop;"
'This example specifies the user to send the object to.
MsgBox "Sending message to: " & sRecipient & "..."
DoCmd SendObject A_TABLE, "Company", A_FORMATXLS, sRecipient, , , "Copy of the company database.", , False
MsgBox "Message sent."
End Function
Below the parameters expected by the SendObject method. As indicated before, if you omit these, MAPI will attempt to resolve the information, either by asking the user to clarify something, or by not sending the message and providing your calling routine with an error message.
ObjectType
Use the Microsoft Access intrinsic constants of A_TABLE, A_QUERY, A_FORM, A_REPORT or A_MODULE (better use 'A_FORM' instead of 'acSendForm').
ObjectName
This is the name of what you're going to send. This can be a form or query name, etc.
OutputFormat
These file types are represented by the A_FORMATXLS, A_FORMATRTF and A_FORMATTXT intrinsic constants.
To, CC, BCC, Subject and MessageText
All items are strings, providing the addressee's name, the message subject and any associated message text. BCC is not currently supported by the MSMail client.
EditMessage
True or False. This controls the display of the send note dialog box.
If the recipient information provided is not valid, the message will not be sent. Instead, your routine will receive an error message indicating that the recipient was not valid.