How do I use a Filter condiition with Output Report (Access XP)

K

Ken Olson

I have a list of about 1,000 classmates that I want to publish as a web
page. This code does just that perfectly.

DoCmd.OutputTo acReport, "rptCreateClassmateList", "MS-DOSText(*.txt)",
"C:\ClassmateList.htm", False, "", 0

I have a form with a command button whose code that I want to create a
separate page each time the first letter of the last name changes. So I
would end up with 26 pages total (Example:ClassmateList_A.htm,
ClassmateList_B.htm, etc.). The code above generates all the names on one
page. The detail area of the report has a field with the following code if
this helps: =Trim('<a href="classmates/ClassOf74Page' & [txtLineNumber] &
'.html" Target=new> ' & [FullName] & "</a><br>"). I have a sub report for
the Report Header and Footer that contains the necessary html begiining and
ending page code.

I could of course create 26 different reports using (Like "a*") as the
Filter value changing the letter for each. Then just create a line of
OutPutTo code for each.

Isn't there a way to feed a Filter value to the OutputTo code? If not, how
about some code to modify the reports Filter value so I won't have to create
26 reports?

Do you or does any one else have a more streamlined approach? I see web
pages like this everywhere, so I have to believe that someone has already
invented this wheel.

Thank you,
 
L

Larry Linson

Consider creating a form where the criteria can be entered, and creating a
new RecordSource for the Report including the entered criteria, and picking
it up in the Open event of the Report to replace the original Record Source.

Larry Linson
Microsoft Access MVP
 
K

Ken Olson

Thanks for your response and idea. I did as you suggested. What I'm getting
is the 26 files with each containing the correct names. However, after about
a dozen or so names, which is about the amount that will fit on a page
between the text contained in my top and bottom sub reports (contained in
the Page Header and Footer), the Page Header and Footer are reprinting.

Ken
 
K

Ken Olson

Thank you for responding, but I don't understand what you mean.


Larry Linson said:
Consider creating a form where the criteria can be entered, and creating a
new RecordSource for the Report including the entered criteria, and picking
it up in the Open event of the Report to replace the original Record Source.

Larry Linson
Microsoft Access MVP


Ken Olson said:
I have a list of about 1,000 classmates that I want to publish as a web
page. This code does just that perfectly.

DoCmd.OutputTo acReport, "rptCreateClassmateList", "MS-DOSText(*.txt)",
"C:\ClassmateList.htm", False, "", 0

I have a form with a command button whose code that I want to create a
separate page each time the first letter of the last name changes. So I
would end up with 26 pages total (Example:ClassmateList_A.htm,
ClassmateList_B.htm, etc.). The code above generates all the names on one
page. The detail area of the report has a field with the following code if
this helps: =Trim('<a href="classmates/ClassOf74Page' & [txtLineNumber] &
'.html" Target=new> ' & [FullName] & "</a><br>"). I have a sub report for
the Report Header and Footer that contains the necessary html begiining and
ending page code.

I could of course create 26 different reports using (Like "a*") as the
Filter value changing the letter for each. Then just create a line of
OutPutTo code for each.

Isn't there a way to feed a Filter value to the OutputTo code? If not, how
about some code to modify the reports Filter value so I won't have to create
26 reports?

Do you or does any one else have a more streamlined approach? I see web
pages like this everywhere, so I have to believe that someone has already
invented this wheel.

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

Top