print form filtered (on a report)

  • Thread starter Victor de Pablo
  • Start date


Victor de Pablo

Hi everyone. Access 2010
I have a FORM (getting data from a QUERY) with "default view" as "datasheet" in whic I apply some filters (like you would do under MS EXCEL) and I would like to be able to print it out (using a REPORT). As it comes as datasheet, what I do is to create another FORM where I put in the original SUBFORM and a button. It is easy to make this button open the REPORT (the REPORT I open is data copy as the SUBFORM) but my problem is that I cannot make itwork only the filtered fields but all of them instead (but this is not what I need).

I've been looking around and I've got more or less the idea that I have to put some code under the button click, but it does not work for me.
Could anyone help me out, pelase?

The code I use is:

Private Sub Comando20_Click()
Dim criterio As String
If Me.FilterOn Then
criterio = Me.Filter
criterio = ""
End If
DoCmd.OpenReport "Inf_ListadoCURSOS", acViewPreview, criterio
End Sub

As a detail, I would like to say that the QUERY I use gets the data from 3 tables linked. And in any other case it does work properly: I have the table "pacients" & "phones" & "therapies" and it does work correct when a pacient can have 1 or more phones and 1 or more therapies.

Any help it would be appreciated!!

Thank you


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