Access 2010 - VBA Load Memo-type data in a text box of a report. Insufficient space

0

To load some data into an Access report, I use the following VBA code:

Private Sub Report_Load()

Call Acceso_Informacion
Dim basica As DAO.Database
Dim tabla_ejemplo As DAO.Recordset
Dim Texto As String

Set basica = CurrentDb
Set tabla_ejemplo = optica.OpenRecordset("Principal_Tabla", dbOpenSnapshot)

tabla_ejemplo.MoveFirst

Texto = tabla_ejemplo.Fields(2).Value


Texto1.Value = Texto

End Sub

The idea is to fill a Textbox with data from an Access table. In principle the method works. The use of embedded macros is avoided and everything is fixed in code. But there is a problem that I can not easily fix. The size of the TextBox must be variable so that, depending on the size of the text to be put there, it becomes more or less large. Thus, if this is the case, the textbox may occupy several pages, or only a few lines.

How could this be done? Is there any way to lengthen both the textbox and the length of the text so that everything appears clear and legible in the report?

Thanks in advance!

    
asked by AccessOPS 11.07.2018 в 17:13
source

1 answer

0

In the Design view of the report, if you select the textbox, in the format tab there should be a property that is called autoextensible . This property obtains or sets whether the specified control is automatically adjusted vertically to print the preview of all the data contained in the control.

The VBA version of this property is called CanGrow. . It is a Boolean property, that is, it only supports True or False.

  

TextBox.CanGrow property   (access)

    
answered by 16.07.2018 / 00:15
source