Merging RTF files into one RTF file

C

Cez

Hi guys,

I am a new developer in MS Access and is currently working on a requirement
which needs for me to combine several text files into one RTF file. So far,
I have these codes:
Dim fileRTF As String
Dim pathApp As String
Dim TextLine As String


pathApp = CurrentProject.Path
fileRTF = pathApp & "\transactionreports.rtf"

DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, pathApp &
"\transaction1.rtf", False
DoCmd.OutputTo acOutputReport, "Report2", acFormatRTF, pathApp &
"\transaction2.rtf", False
DoCmd.OutputTo acOutputReport, "Report3", acFormatRTF, pathApp &
"\transaction3.rtf", False
DoCmd.OutputTo acOutputReport, "Report4", acFormatRTF, pathApp &
"\transaction4.rtf", False

Open fileRTF For Output Access Write As #1

Open pathApp & "\transaction1.rtf" For Input As #2
Do While Not EOF(2)
Line Input #2, TextLine
Print #1, TextLine
Loop
Close #2

Open pathApp & "\transaction2.rtf" For Input As #3
Do While Not EOF(3)
Line Input #3, TextLine
Print #1, TextLine
Loop
Close #3


With these codes, I didn't have error, four RTF files were created. However
the output file only contains the first file transaction1.rtf. I tried to
trace it, and the program runs the second loop, too, and yet when i opened
the output file only contains the first text file.

Is there something I miss here? Do we have a special function to append to
an existing file?

Any input will be great. Thanks in advance...
 
S

Stephen Lebans

If you do not want to work directly with the RTF encoding then a simple
method is to use 2 RTF controls(in/out) and cocatenate their contents into
the output RTF control.
There are several threads on this issue as it has surfaced in the Access
NG's several times over the past couple of years.

lebans rtf2 control cocatenate
http://groups.google.ca/groups?hl=en&q=lebans+rtf2+control+cocatenate


--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
C

Cez

Thanks, Stephen. That's a good idea, though for now, having to use a
third-party software is not yet an option.
 
C

Cez

Hi Stephen,

I might have overlooked in my suggestion as having to use a third-party
sofware when you suggested about using RTF controls. I am currently using MS
Access 2003, are these controls already available in this version? I've
already looked but found nothing of the name that sounds like for an RTF
control.

Thanks in advanced.
 
C

Cez

It's okay now. I was able to look for other related posts and found the link
of your RTF control. Thanks for having guys like you around.
 

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