[AccessD] DoCmd.Sendobject

Heenan, Lambert Lambert.Heenan at chartisinsurance.com
Thu Aug 25 15:42:27 CDT 2011


<Pedant_Mode_On> 

acFormatSNP is a predefined constant (not a keyword) inside the Access environment. It is a string that happens to have the literal value "Snapshot Format (*.snp)" (minus the quotes), but we don't need to be aware of that. 

<<Pedant_Mode_Off> 

:-)


Lambert

-----Original Message-----
From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Dan Waters
Sent: Thursday, August 25, 2011 4:02 PM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] DoCmd.Sendobject

Hi Den,

The only thing I see that you could change is "SnapshotFormat" to acFormatSNP.  acFormatSNP is an Access key word (just like acSendReport), so it should not be entered with quotation symbols.

Good Luck,
Dan

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Den Patrino
Sent: Thursday, August 25, 2011 12:29 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] DoCmd.Sendobject

I have the following procedure the works in Access 2003 and Outlook 2003 but does nothing in Access 2007 and Outlook 2007.
I hate to say 'does nothing' but the user is in another location and I haven't stepped through the code or seen 1st hand what is happening except no one gets the mail.
using the Access.mde (Access 2003) on the Access 2007 pc. There are no other problems.

At this point, I'd like to know if anyone has had trouble with the DoCmd.SendObject acSendReport

TIA, Patty

Private Sub cmdMailReport_Click()
On Error GoTo Err_cmdMailReport_Click
    Dim strDocName As String
    Dim strLinkCriteria As String
    Dim strEMailRecipient As String
    Dim strEMailCC As String
    Dim strSubject As String
    Dim strMessage As String

    If Me.Dirty Then
        DoCmd.RunCommand acCmdSaveRecord
    End If
    strDocName = "rptOffQuality"
    strLinkCriteria = "[ID_Num]=" & "'" & Me![txtID_Num] & "'"
'   Print the current record on the printer
    DoCmd.OpenReport strDocName, acNormal, , strLinkCriteria

    strEMailRecipient = "userx at somewhere.com; usery at somewhere.com"
    strEMailCC = "userz at someone.com"
    strSubject = "Disposition of Product"
    strMessage = "The attached file was sent via the Production Foreman and"
& _
                vbCrLf & "contains important inspection requirements"
'   Send the report via email
    DoCmd.SendObject ObjectType:=acSendReport, _
        objectname:=strDocName, _
        outputformat:="SnapshotFormat", _
        To:=strEMailRecipient, _
        Cc:=strEMailCC, _
        Subject:=strSubject, _
        MessageText:=strMessage
    Exit Sub

Exit_cmdMailReport_Click:
    Exit Sub
Err_cmdMailReport_Click:
    MsgBox Err.Description
    Resume Exit_cmdMailReport_Click

End Sub
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list