sendobject

G

Guest

I want to use sendobject based upon the active form record. I would like to
automatically send it as a snapshot. How would I accomplish this?

DoCmd.SendObject acSendReport, "Tolerance_report", , , , , "Sedalia Out of
Tolerance Report", , True

This is what I have so far.

Any help will be appreciated,
Pixie
 
A

Allen Browne

Since SendObject lacks the WhereCondition you use with OpenReport, you must
apply a Filter in the Open event of the report.

1. In the General Declarations section (top) of a standard module (Modules
tab of Database window), enter:
Public gstrReportFilter As String

2. In the Open Event procedure of your report:
If gstrReportFilter <> vbNullString Then
Me.Filter = gstrReportFilter
Me.FilterOn = True
gstrReportFilter = vbNullString
End If

3. Just above your SendObject code, assign the string, e.g.:
gstrReportFilter = "ID = " & Me.ID
 
G

Guest

I did it by opening the report the using the send object and then closing the
report when it was all done.
Thank you very much for the help.
Pixie
 
Joined
Feb 23, 2010
Messages
1
Reaction score
0
I tried this code, and it doesn't quite work right. I have two buttons, "Print Requisition" and "Submit Requisition". The OpenReport line worked as desired and opened only the current record, but the SendObject would get the last report opened by OpenReport. I just combined the code like this:

'gstrReportFilter = "OrderID = " & Me.OrderID
DoCmd.OpenReport "Requisition", acViewPreview, , "OrderID = " & Me.OrderID
DoCmd.SendObject acSendReport, "Requisition", "Snapshot Format (*.snp)", _
"(e-mail address removed)", , , "Requisition for " & Me!UserID & " from " & Me!VendorID, , True

Obviously, gstrReportFilter no longer does anything and is a comment. I decided I would actually prefer these things to happen under one command button click. However, I'm curious what detail I missed. The code Allen Browne submitted would filter down to only one record, but it was the last record opened by OpenReport, and not the current record on the form when SendObject was used with gstrReportFilter. Why?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top