Printing subform data

  • Thread starter Thread starter SirPoonga
  • Start date Start date
S

SirPoonga

I haven't used any printing functionality in Access before so I don't
know where to start.

I have a form with a subform. The controls in the form setup a filter.
Click a button and it filters the records in the subform by setting
the subform's filter, order by, recordsource properties.
The subform is in datasheet view.
I'd like to make a print button that prints the data that has been
filtered in the subform.

My guess is the best way to do that is setup a report. Set that
report's properties to same as the subform and print it? How would I
do that in code? Is there a better way?
 
Dim myReport as Report
Set myReport = Reports("rptSubformQuery")

I tried that but it says the report doesn't exist. I copy and pasted
the name of the report.
 
easiest solution would be to set your report's recordsource the same as
the subform. Using your main form's 'filter' controls construct a SQL
string to pass to the report when you call it open (in the
[WhereCondition] parameter).
Another possibilty is to access the subform's property and grab the
source and filter info and pass it to your report. I can't remember if
I've done this before so it may not work.
 
How do I do this? I am getting erros of not being able to find the
report witht he code I am trying.
 

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

Back
Top