Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to output a file one by one when pressing one button only

Status
Not open for further replies.

COII

IS-IT--Management
Oct 11, 2001
28
HK
Dear all,

I have a problem about export a report to HTML. I have a form called "Print Dialog". From here, I create a button named "Output to HTML". When pressing this button, a report called "HTML" will be saved as HTML FILE. But, report named "HTML" have ten pages & ten different company accordingly. I would like to obtain result as follows:

When pressing the button "Output to HTML",

Page 1 of "HTML" save as A.html
Page 2 of "HTML" save as B.html
Page 3 of "HTML" save as C.html
.....
.....
Page 10 of "HTML" save as J.html


Can I do that?
 
When you use OutputTo, it is not simple because there is no Where clause there.

What I could suggest to avoid duplicating Report is to use a Request as a DataSource for your HTML report and introduce a condition in the Company field in this request.
in the form <=ThisCompany()>

In an independant Module,
Create the Function:
>>Public Function ThisCompany () as Integer
>>ThisCompany=GV_Company
>>End Function

Create the Global variable GV_Company
>>Public GV_Company as Integer

Behind you button, put some code like:

>>GV_Company=1
>>DoCmd.OuputTo &quot;HTML&quot;,......
>>GV_Company=2
>>DoCmd.OuputTo &quot;HTML&quot;,......

and so on
(I assumed that the Company is coded as an Integer - could be any type)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top