Re: RTF2 Control - Printing a Report throwing Property is Read-Onl

From: Stephen Lebans (ForEmailGotoMy.WebSite.-WWWdotlebansdotcom_at_linvalid.com)
Date: 03/17/05


Date: Thu, 17 Mar 2005 08:06:01 -0400

Please post all of your code behind the report. Do not leave anything
out.

--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Toby Cundell" <TobyCundell@discussions.microsoft.com> wrote in message
news:C9A5A3AC-9986-412A-864E-B083C83E0C24@microsoft.com...
> I know I cant do that in the Print, but I gave it a shot just to
eliminate
> all the possibilities...
>
> What line does it occur in?  See thats the whole problem.  I can
step-trace
> the detail_format code during the report opening for preview but I
cant step
> through during the actual printing.
>
> Further testing shows that the detail_format code is executing during
the
> print phase because I inserted a msgbox into the code and it displays
the
> dialogs while printing along with the errors.  I turned off my error
trapping
> dialog and the errors still show up so there is an error being
triggered in
> and being displayed in the control itself.
>
> I guess what I am asking is there a way to tell the control not to
display
> errors in certain circumstances? It DOES print the document correctly
so the
> formatting is working during printing (or I guess its leftover from
> previewing??) but the control throws an error anyway.  More of an
annoyance
> bug than anything.  Due to the nature of the formatting routine, a 10
> paragraph printout will generate 25 error dialogs.
>
> BTW, the error dialogs are formatted like this: title = RTF2, Big Red
X
> Icon, text = Property is read-only.
>
> Let me know if that explains it better.
>
> Thanks
> Toby
>
>
>
> "Stephen Lebans" wrote:
>
> > You cannot resize controls, any controls, in the Print event. You
must
> > use the Format event as my sample code shows.
> >
> > What is the line of code that is causing the error?
> >
> > --
> >
> > HTH
> > Stephen Lebans
> > http://www.lebans.com
> > Access Code, Tips and Tricks
> > Please respond only to the newsgroups so everyone can benefit.
> >
> >
> > "Toby Cundell" <TobyCundell@discussions.microsoft.com> wrote in
message
> > news:C3127BB7-A67D-43CF-B772-9D040947FAB7@microsoft.com...
> > > As an update I removed the Detail_Format code and the preview of
the
> > form
> > > doesnt work anymore but that does fix the printing problem.  So it
> > must
> > > somehow fire the code in the Detail_Format during printing but
> > apparently you
> > > cant trap for it at that time.  I put the code in the Detail_Print
> > area and I
> > > get an error that I cant change the height of a control while
trying
> > to
> > > print.  Long story short, I dont know where else to put the
formatting
> > code
> > > so that it works.
> > >
> > > Here is the Detail_Format code:
> > >
> > > Private Sub Detail1_Format(Cancel As Integer, FormatCount As
Integer)
> > >
> > >     On Error GoTo err_Detail_Format
> > >     Dim Height As Integer
> > >     Me.RTFControl.Object.RTFtext = ""
> > >     Me.RTFControl.Object.RTFtext = Me.RTFParagraph
> > >     Height = Me.RTFControl.Object.RTFheight
> > >       If Height > 0 Then
> > >         If Height < 32000 Then
> > >             Me.RTFControl.Height = Height
> > >         End If
> > >     End If
> > >     Me.Section(acDetail).Height = Me.RTFControl.Height +
> > Me.RTFControl.Top
> > >
> > >     If Me.RTFControl.Object.RTFheight > 0 Then
> > >         If Me.RTFControl.Object.RTFheight < 32000 Then
> > >             Me.RTFControl.Height = Me.RTFControl.Object.RTFheight
> > >         End If
> > >     End If
> > >     Me.RTFControl.RTFtext = Me.RTFControl.RTFtext
> > >
> > >
> > > exit_Detail_Format:
> > >     Exit Sub
> > >
> > > err_Detail_Format:
> > >     If Err.Number <> 2427 Then
> > >         MsgBox Err.Description
> > >     End If
> > >     Resume exit_Detail_Format
> > >
> > > End Sub
> > >
> > > The form is set to read data from a table.
> > >
> > > Thanks
> > >
> > >
> > >
> > > "Stephen Lebans" wrote:
> > >
> > > > That error is generated if you try to read/write to the control
> > before
> > > > it is fully instantiated. Youare probably trying to access the
RTF2
> > > > control inthe Report's Open event. No ActiveX controls are fully
> > > > instantiated at that point on a reliable basis. Move your code
to a
> > > > later event.
> > > >
> > > > --
> > > >
> > > > HTH
> > > > Stephen Lebans
> > > > http://www.lebans.com
> > > > Access Code, Tips and Tricks
> > > > Please respond only to the newsgroups so everyone can benefit.
> > > >
> > > >
> > > > "Toby Cundell" <Toby Cundell@discussions.microsoft.com> wrote in
> > message
> > > > news:D010BFE6-3801-45F4-88B5-9C67B3183153@microsoft.com...
> > > > > I have a problem with the RTF2 control in Access 2003.  I used
the
> > > > example
> > > > > database from the Lebans site by Andre Minhorst to split apart
> > long
> > > > text into
> > > > > the series of paragrphs.
> > > > >
> > > > > This works great in preview mode but throws a Property is
> > Read-Only
> > > > error
> > > > > for every instance of the control on the page when you try to
> > print
> > > > the
> > > > > report. I tried trapping this error through all the normal
ways I
> > know
> > > > how
> > > > > and I havent found a way to keep it from throwing the error.
The
> > > > report
> > > > > DOES print correctly however.  But it is unacceptable for the
> > client
> > > > to
> > > > > have to click OK on an error box once for every paragraph to
print
> > a
> > > > report.
> > > > >
> > > > > The example database from the Lebans site (RTF00_1_5.mdb) has
the
> > same
> > > > > problem when you try to print the paragraphs version.
> > > > >
> > > > > Thank you very much in advance for any help!!!
> > > > >
> > > >
> > > >
> >
> >


Relevant Pages

  • Re: Conditional formatting changes field enabled property?
    ... set the FomatConditions object props for this control to the previously ... Access Code, Tips and Tricks ... formatting he wants the condition to set AND, most ... "Stephen Lebans" wrote: ...
    (microsoft.public.access.forms)
  • Re: Conditional formatting changes field enabled property?
    ... The CF routine can only handle 3 criteria. ... Your conditional formatting VB code almost ... "Stephen Lebans" wrote: ... applied, on a Control by Control basis, based on the criteria YOU set. ...
    (microsoft.public.access.forms)
  • Re: Conditional formatting changes field enabled property?
    ... it will HOLD that user-set formatting forever (until the user ... "Stephen Lebans" wrote: ... return True or Flase depending if you want CF to paint the control or not. ... Access Code, Tips and Tricks ...
    (microsoft.public.access.forms)
  • Re: Conditional formatting changes field enabled property?
    ... I think you are misunderstanding the use of Conditional Formatting. ... applied, on a Control by Control basis, based on the criteria YOU set. ... Access Code, Tips and Tricks ... "Stephen Lebans" wrote: ...
    (microsoft.public.access.forms)
  • Re: RTF2 Control - Printing a Report throwing Property is Read-Onl
    ... I know I cant do that in the Print, but I gave it a shot just to eliminate ... dialogs while printing along with the errors. ... I guess what I am asking is there a way to tell the control not to display ... Due to the nature of the formatting routine, ...
    (microsoft.public.access.reports)

Loading