Print all records on Form

G

Guest

I am having a problem. I created a main form that filters many different
options and then opens another form. From there the user can double click
any record to get more detail, but I would like to also give them the option
to print only the records on the form as well in a report. But everytime I
click the button to print the report all the records from the query print.
Not just my filtered records.

Can anyone help me? Thanks!
 
A

Allen Browne

You can apply the form's filter to the report by putting code like this in
the Click event procedure of a command button on your form:
Dim strWhere As String
If Me.Dirty Then Me.Dirty = False
If Me.FilterOn Then strWhere = Me.Filter
DoCmd.OpenReport "Report1", acViewPreview, , strWhere
 

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