SendTo - problem

  • Thread starter Thread starter Johnny
  • Start date Start date
J

Johnny

I am trying to send a report from a form using DoCmd.SendObject. But I am
having difficulty in making a filter or a "Where-condition" for this
function. When I push the button the access send all reports (175) in one
mail, but I want it to send only one at a time.

Is there anyone who have some experience with this?

Johnny
 
SendObject does not have a WhereCondition like OpenReport has.

The workaround is to declare a public string variable in the General
Declarations of a standard module, e.g.:
Public gstrReportFilter As String

Assign a filter before calling SendObject, e.g.:
gstrReportFilter = "ClientID = " & Me.ClientID

Then use the Open event of the report to check, apply, and reset the string:
Private Sub Report_Open(Cancel As Integer)
If Len(gstrReportFilter) > 0& Then
Me.Filter = gstrReportFilter
Me.FilterOn = True
gstrReportFilter = vbNullString
End If
End Sub
 
Back
Top