printing with RTF2 control from Lebans

D

Dan Keck

I have a question regarding the RTF2 control by Stephen Lebans. I am
investigating using it in an Access 2003 report. It seems like a great
control, and it works very well until I try to print the report. During
the Detail_Format event, I set the value of RTFtext in the RTF2 control.
This works fine in print preview, but causes the following error to
pop up when printing or exporting to a Snapshot file: "Property is read
only".

I have seen other newsgroups postings where Lebans said that this error
will occur when a property is set in the Open event of a report rather
than a later event. However, I cannot tell how this relates to the
Detail_Format even when printing.

If anyone has a clue about this, it would help me out.

Thanks
Dan Keck
 
S

Stephen Lebans

Do you have code in any other event that tries to reference the RTF2
control?

--

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

Kranman

I am also receiving the exact same error. I created a multi page
report in A2K using RTF2 v1.8 last year. The report opened in preview
and printed perfectly. Earlier this year I upgraded the computers in my
office to A2003. Only today have I needed to run this report. When I
open the report to preview, there are no errors. When I print the
report it throws an error for each instance in the report. I still
have one PC that has A2K on it. When I open the db on that PC once
again it previews and prints perfectly.

I run my code in the GroupHeader_Format section. Based on the fact
that the same db prints fine on A2K but not on A2003 possibly indicates
an issue with RTF2 and A2003
 
S

Stephen Lebans

Well you should not be getting that error when printing the report. Access
is complaining that you are writing to the RTF2 control when it is not
available to be written to.
I just tested with Access 2003, both with Unbound and Bound RTF2
controls...no errors. There is something in your configuration that must be
different from mine. How do we find out? I'm just not sure.

Can you send me the MDB containing your report so that we can eliminate the
possibility that it is specific reports that are causing the issue.

--

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

Kranman

Stephen,

I wish I could comply with your request; however the MDB consists of a
front end and back end, both rather large and containing confidential
information. I can post screen shots of my report with controls and
code behind, which there is not much of. I would be willing to make any
changes to the above at your request for troubleshooting purposes.

I am still not sure that it is a specific report that is causing the
issue as the exact same report prints fine in A2K, but not A2003 (by
the way both PCs using WinXP pro). Maybe Dan could send his MDB. I
will try to create a sample MDB with similar code to see if I can
generate the same error. I could then forward it on to you if
successful.

Thanks and Best Regards,

Steve
 
K

Kranman

Stephen,

I was able to export the problem report along with its sub-report to a
new MDB. I did not port over any tables or queries that the reports'
controls are bound to. You can open the report although there are data
errors. The report still throws the "Property is Read Only" error
when printing in Access 2003. However I did test this new MDB on a A2K
PC and the report prints without error.

I will email you through your web site, and you can respond with
directions on how to send you the MDB.

Steve
 
S

Stephen Lebans

Hi Steve,
you are misunderstanding how to load RTF text into the control. Your code is
trying to use the Selxxx props to set Font properties. You simply cannot do
this with an ActiveX control on a report at runtime as there is no active
user interface available.
What you need to do is build the RTF string, including the desired Fonts
props, and then set the RTFtext prop in the format event of the relevant
section.

--

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

Stephen Lebans

I do not have Access 2007 installed yet so I cannot debug this issue.
This error message signifies that the control's Properties are not
available to be written at this time. Prior to A2007, you could legally
write to the control in the format event of the relevant section containing
the control.

But it may simply be a Subreport issue. Does the control work in A2007
without using a subreport? If so then you will have to call your code from
the Format event of one of the sections directly on the SubReport.


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

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