Question for Mr. Lebans

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to use your AutosizeOLE and RTF2 together in one report. this
would mean that there would be a rich text field and a OLE field and they
both can resize. the OLE field is after the RTF2. The problem is that the
picture shows up where it suppose to in the report and that sometimes means
right in the middle of the text, depending on how long the text is.

Can you please help me out with this?
 
I don't completely understand your issue. Do you have, in the detail
section:
RTF2 Control
with a Bound OLE frame control directly beneath it?

You are sizeing the RTF2 control and then need to position the Bound OLE
Frame control so that it is still directly underneath the RTF2 control?

Are you calling my code from the Format event of the Detail section? I don't
see why it should not work except in CanGrow situations across a page
boundary.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Thanks for your reply,
That is exactly what I am doing. here the code that I have put for format
event of the detail:

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
Dim Height As Integer

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


' Call our Autosize function if the
' control is not empty.
If Not IsNull(Me.OLEBoundAutosize.Value) Then
AutoSizeOLE Me.OLEBoundAutosize
End If

End Sub

It is basically the code for RTF2 with the AutoSize added to the end of it.

when the text is large enough to reach where the picture is located then the
picture and text show up on top of each other. in another word, the bound OLE
field does not move to where the text ends.

Thanks again,
 
Well you are autosizeing the OLE Frame control but then you are NOT moving
it to reflect the newly autosized RTF2 control. After you AUtosize the OLE
frame control simply move it. SOmething like:
ME.NameOfOLEFrameControl.Top = Me.RTFControl.Top + Me.RTFCOntrol.Height +
100
' 100 is just a spacer value so the two controls do not overlap. CHange it
to the desired amount.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
I appologize for taking your time but I am not good at this at all and your
help is much appreciated.
I did what you said and ended up with this:

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
Dim Height As Integer

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 +
Me.OLEBoundAutosize.Height

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

If Not IsNull(Me.OLEBoundAutosize.Value) Then
AutoSizeOLE Me.OLEBoundAutosize
Me.OLEBoundAutosize.top = Me.RTFcontrol.top + Me.RTFcontrol.Height + 100
End If

End Sub

when I run the report I get a code error and the line I added:

Me.OLEBoundAutosize.top = Me.RTFcontrol.top + Me.RTFcontrol.Height + 100

shows up in yellow. it seems as if properties for my "OLEBoundAutosize"
field are not available or defined and I am not sure what to do about it.

Thanks again,
 
Not sure why you are seeing an error with the Top property as every control
exposes one. Perhaps you have the Ole Frame control with the exact same name
as the field it is bound to. Change the name of the bound OLE Frame control
from:
OLEBoundAutosize
to
OLEBoundAutosize
fcOLEBoundAutosize

Make sure you modify your code below to include the change of names for the
bound OLE Frame control.

The order of events should be:

Resize the Ole frame control
Resize the RTF2 control
Position the OLE frame control
Resize the Detail section

Let me know how you make out.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
Ok, I did what you said. I actually changed the name of the field to
"full_pics" and put the code in the order that you said. I ended up with:

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
Dim Height As Integer

If Not IsNull(Me.full_pics.Value) Then
AutoSizeOLE Me.full_pics
End If

Height = Me.RTFcontrol.Object.RTFheight
If Height > 0 Then
If Height < 32000 Then
Me.RTFcontrol.Height = Height
End If
End If

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.full_pics.top = Me.RTFcontrol.top + Me.RTFcontrol.Heigh

Me.Section(acDetail).Height = Me.RTFcontrol.Height + Me.RTFcontrol.top +
Me.full_pics.Height


End Sub

The "Me.full_pics.top = Me.RTFcontrol.top + Me.RTFcontrol.Heigh" is still
creating an erro code which is:

Run-time error '438':

object does not support this property or method


Thanks again.
 
Don't change the field name. I said to change the NAME of the OLE Frame
control bound to the field. I just want to make sure that the Name of the
Field is not the same as the Name of the OLE Frame control. Do you
understand what I am getting at?

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
I made a mistake when I said the field. I actually changed the name of the
bound OLE frame. so my frame in the report is called "full_pics" and the
field in the table is called "pictures".
 
No problem. Why don't you Email me your MDB as we seem to be at an impasse
with your issue. If the data is confidential just delete all of it and add
back a couple of rows with garbage data.
(e-mail address removed)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
I will do that right now. thank you very much.

Stephen Lebans said:
No problem. Why don't you Email me your MDB as we seem to be at an impasse
with your issue. If the data is confidential just delete all of it and add
back a couple of rows with garbage data.
(e-mail address removed)

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 
You have to set the Section height before you place the OLE Frame control
otherwise there is not enough space in the section and you generate the
error you were seeing. One other thing, when someone asks you to Email them
a file, 40 MB's is just way to large.

Here you go:

Private Sub Detail1_Format(Cancel As Integer, FormatCount As Integer)
Dim Height As Integer


Height = Me.RTFcontrol.Object.RTFheight
If Height > 0 Then
If Height < 32000 Then
Me.RTFcontrol.Height = Height
End If
End If

AutoSizeOLE Me.full_pics
Me.Section(acDetail).Height = Me.RTFcontrol.Height + Me.RTFcontrol.top +
Me.full_pics.Height + 100

Me.full_pics.top = Me.RTFcontrol.top + Me.RTFcontrol.Height + 10


End Sub

--

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