SendObject unusual syntax: want to adapt but don't understand it!

Abiart

Registered User.
Local time
Today, 01:29
Joined
May 17, 2006
Messages
27
Hi everyone,

This is a small part of a bigger problem, but it's one step at a time so here goes:

Code:
            DoCmd.SendObject outputformat:=acFormatTXT, _
                            To:=rst(EmailAddressField), _
                            subject:=Me.Controls(MsgSubjectField), _
                            MessageText:=strMsgToSend, _
                            EditMessage:=False
        
            If Err.Number <> 0 Then ' SendObject raised an error
                bSendError = True
                Err.Clear
            End If

How does this fit into the syntax:

Code:
SendObject (Object Type,Object Name,Output Format,To,Cc,Bcc,Subject,Message Text,Edit Message,Template File)

When, as far as I know, a normal SendObject procedure looks like this:

Code:
On Error GoTo DistributorsSummary_Err

    DoCmd.SendObject acReport, "Distributors Summary", "SnapshotFormat(*.snp)", "example@domain.com", "", "", "Example Email", "Dear such and such please find attached etc.", False, ""
    
DistributorsSummary_Exit:
    Exit Function

DistributorsSummary_Err:
    MsgBox Error$
    Resume DistributorsSummary_Exit

End Function


The reason I ask is because I want to take some of the elements from the second procedure, namely attaching a report snapshot, to the first one, which forms a small part of some code in my database.

I realise it is due to the fact that several of the field names are defined at the beginning of the code, but I'm not sure how to adapt it.

Thanks in advance!
 
While you are correct about the "normal" SendObject format, the method in your first example is available as an alternative. Basically, instead of relying on the specific positions of each argument, as the "normal" format requires, you can specifically enumerate each one, and not worry about position. You can change that to the format you're used to, or add additional arguments as needed.
 

Users who are viewing this thread

Back
Top Bottom