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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing an argument in sendobject method - how?

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
I'm automating sending an email (fax). In some code the technique of argument passing is used for the strLinkCriteria . How would I use this in my code?

Code:
    strReportName = "rprtInvoiceFax"

            strWhere = "BolImportID = " & Me.BolImportID

            DoCmd.SendObject acSendReport, strReportName, acFormatHTML, EmailAddress2, , , strSubject, , False



Pampers [afro]
Just let it go...
 
pampers

Open the report passing the WHERE clause and then dont specify the report name when sending. This shall result in sending the active report.
 
Tnx Jerry for the respons,
But I dont understand what "Open the report passing the WHERE clause" means, especially "passing the WHERE clause".


Pampers [afro]
Just let it go...
 

strWHERE = "Skopos2='AAL'" 'Filters the report's recordset

DoCmd.OpenReport "PerProduct", acViewPreview, , strWHERE
DoCmd.SendObject acSendReport,,acFormatHTML, EmailAddress2, , , strSubject, , False

 
Hi Jerry,

I understand that the strWhere clause in
DoCmd.OpenReport "PerProduct", acViewPreview, , strWHERE

But the code I copied uses it directly in the sendobject method, without first opening the report. Here is the code (
Code:
 ' **************************************
    ' Walking through the Customers recordset until end of file, setting the global variable
    ' strInvoicesWhere to the current where and using SendObject passing
    ' customers fax number and report name.
    ' **************************************
    
    If MsgBox("Do you want to fax invoices" & Chr(13) & "to all customers using MSFax?", 4) = 6 Then
        With rstCustomers
        Do Until .EOF
            strInvoiceWhere = "[customerid] = '" & ![CustomerID] & "'" ' sets global strInvoiceWhere
            DoCmd.SendObject acReport, "rptMSFaxInvoice", acFormatRTF, "[fax:" & ![Fax] & "]", , , , , False ' Runs Report to MSFax
            .MoveNext ' Move to next record in Recordset
        Loop
        End With
    End If




Pampers [afro]
Just let it go...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top