Allen Browne’s Filter Form

  • Thread starter open a adobe file from a command button
  • Start date
O

open a adobe file from a command button

I’m using Allen Browne’s filter form that he designed in June 2006, where the
criteria is entered in the header section, this filtering system works very
nicely for me. I would like to add a command button in the footer section
that puts the filtered information in an e-mail or a word document for
e-mailing. Can someone help me, please?

Thanks
 
A

Allen Browne

There's a couple of ways to approach this.

The simplest is to use the filter applied to your form as the filter for the
report also. You open the report filtered in Print Preview, and you can then
email it as filtered.

Private Sub cmdSend_Click
Dim strWhere As String
If Me.FilterOn Then
strWhere = Me.Filter
End If
DoCmd.OpenReport "Report1", acViewPreview, , strWhere
DoCmd.SendObject ...
End Sub

A few things can go wrong there:
a) In Access 2002 and later, if the filter includes a combo box where the
display column is not the bound column, there will be strange names in the
filter string (typically "Lookup..."), so when you try to apply this to the
report, it doesn't work. The solution is to redesign the query you use as
the source for your report, using the same alias for the lookup table as
Access used in your filter.

b) Opening the report filtered in print preview and then hoping that the
same filter gets applied to the instance you output or sendobject from is a
bit dodgy. This is the kind of thing that could break in some versions of
Access, if Microsoft ever gets around to trying to fix the Filter so you can
actually manipulate multiple instances of a report independently as you do
with forms. For this reason, my preference would be to alter the
RecordSource of the report in its Open event so that it includes the filter,
rather than just hope it works.

HTH

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

"open a adobe file from a command button"
 

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