Is there a way to export reports to HTML/RTF through VB?

  • Thread starter Thread starter Hajime Kusakabe
  • Start date Start date
H

Hajime Kusakabe

If you kno please let me know if there is a way to export report to HTML/RTF
through VB.
I would like to do something like

dim i
i = 0
while not rs.eof
* Open a report
* Apply records to the report from rs (record set)
* Save the report as i.htm/i.rtf on C:\
rs.movenext
loop

Thanks.
Haji
 
Haji:

1.) You would use the command OutputTo to output an access report to RTF or
HTML from within VB as in:

objAccess.Application.DoCmd.OutputTo ........

2.) The problem you will have is applying the records from a specific record
set or filtering the report, because Output to does not in and of itself
support any type of filtering. To work around that, you have to create in
Access a module and set of functions that include a function to set a module
level variable with the filter you want to apply and a function that the
report calls in its on open event to get the value of the filter (SQL Where)
and then the report applies that filter if it exists by setting the filter
property of the report and the FilterOn property to True. You call your
Access function like so from within VB:

objAcess.Application.Run "YourFunctionName", "[CustomerID]= " & 12324

Then call the OutputTo method as above.
 
Thanks!

Haji

SA said:
Haji:

1.) You would use the command OutputTo to output an access report to RTF or
HTML from within VB as in:

objAccess.Application.DoCmd.OutputTo ........

2.) The problem you will have is applying the records from a specific record
set or filtering the report, because Output to does not in and of itself
support any type of filtering. To work around that, you have to create in
Access a module and set of functions that include a function to set a module
level variable with the filter you want to apply and a function that the
report calls in its on open event to get the value of the filter (SQL Where)
and then the report applies that filter if it exists by setting the filter
property of the report and the FilterOn property to True. You call your
Access function like so from within VB:

objAcess.Application.Run "YourFunctionName", "[CustomerID]= " & 12324

Then call the OutputTo method as above.
--
Steve Arbaugh
ACG Soft
http://ourworld.compuserve.com/homepages/attac-cg


Hajime Kusakabe said:
If you kno please let me know if there is a way to export report to
HTML/RTF
through VB.
I would like to do something like

dim i
i = 0
while not rs.eof
* Open a report
* Apply records to the report from rs (record set)
* Save the report as i.htm/i.rtf on C:\
rs.movenext
loop

Thanks.
Haji
 
Back
Top