Repost-Import text file into Report

  • Thread starter Thread starter Al
  • Start date Start date
A

Al

I have trying to get this to work for about two weeks
now. Please help!
I have a form that allows a user to type a report into a
Richtext box and then save the file to a network folder.
The path of this file is stored in a Log table with its
associated record. I want to be able to open this file
into a report that will be formatted according to an
existing report style.

Ideally, I would like to open the file into a Richtext
box, to maintain formatting, on the report. I have been
unsuccessful so far and am ready to just resign to
importing the file into a textbox... but haven't been able
to do this either.

Has anyone had any experience with this? Any suggestions
are welcome on the best method of doing this.
TIA,
Al
 
Al:

Is the file saved with all the rtf characters and syntax? If so (even if
its saved as text) its pretty easy to bring this into your report.

1.) Add an RTF control to the report; make sure that the Text property of
the control is empty
2.) Have your report's query contain a field that has the path to the target
file.
3.) In the On Format event for the section that contains the RTF control
then add code like this:

Dim objRTF As Object
Set objRTF = Me.MyRTFControl1.Object
If FormatCount = 1 then
With objRTF
.LoadFile Me!ControlWithPathToRTFFile
End With
End if

Should be pretty easy although potentially slow since you're pulling across
a network. You might want to store the RTF data as a stream in an OLE
(Blob) field in the db which could be faster to retrieve for reporting.
 
Thanks Steve,
I have been trying to use Loadfile but it doesn't work
with Reports, only with Forms. I tried the code you
posted and it opens the report with nothing in the
Richtextbox. When I step through the code, the path to
the existing .rtf file populates a test variable I tried
after it didn't run the first time through.
I'm able to use Loadfile in a form and it populates the
Richtextbox flawlessly. Reports just don't recognize it
and that's why I'm trying to come up with an alternative
method.
I have never worked with OLE Blobs, how do they work?
Thanks again,
Al
 
Back
Top