Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Report: Lebans' Rtf2 Height Issue

Status
Not open for further replies.

Luzbel

IS-IT--Management
Apr 20, 2007
45
PR
I'm using Lebans' RTF2 Control to display a varchar field from a SQL table in an Access Report. The RTF text in a field can span up to 5+ pages. I am having problems displaying the text when it exceeds one page.

Using the following code I get the error: "The control or subform control is too large for this location." on the line Me.RTFControl.Height = intHeight

Code:
' Check for the text in the control
  strText = Me.RTFControl.Value

  ' If there is no text make the height 0
  ' Without this code the control would be
  ' 240 twips if there is no text.
  If Trim$(strText) = "" Then
    Me.RTFControl.Height = 0
  Else

    ' Retrieve height from Total Access Memo
    intHeight = Me.RTFControl.RTFheight

    'If control will exceed maximum report height
    If Me.RTFControl.Top + intHeight > MAXREPORTHEIGHT Then
      intHeight = MAXREPORTHEIGHT - Me.RTFControl.Top
    End If

    ' Resize control based on height returned
    Me.RTFControl.Height = intHeight
  End If

  ' Check to see if the version of MS Access is 2000
  ' or higher. Changing Detail.Height is not supported
  ' in versions of MS Access less than 2000
  If Val(SysCmd(acSysCmdAccessVer)) < 9 Then
    ' Do nothing since previous versions of Access do not support the
    ' detail section being able to shrink again at runtime with
    ' this method.
  Else
    Detail.Height = RTFControl.Top + RTFControl.Height
  End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top