Private Sub Report_Open(Cancel As Integer)
'Como el informe no tiene la propiedad RecordSetClone para jugar'
'con los registros, tenemos que averiguar cúantos hay de este manera.
Dim Rst As Recordset, RecSource As String, Rc As Long
RecSource = Me.RecordSource
Set Rst = CurrentDb.OpenRecordset(RecSource)
Rc = Rst.RecordCount 'Número de registros que saldrán en el informe
Rst.Close
Set Rst = Nothing
With Me.Printer 'Configuramos la página
.DefaultSize = False 'El tamaño de la columna no es igual al detalle
.ItemLayout = 1953 'Se distribuye a lo ancho y luego a lo alto
If Rc <= 40 Then 'Si hay menos de 40 registros
.ItemsAcross = 1 'Configuramos a una columna
.ColumnSpacing = 0
.ItemSizeWidth = 8340
Me.Text0.Width = 3270 'Adaptamos el ancho de los controles
Me.Text1.Width = 1005
Me.Text2.Width = 2160
Me.Text3.Width = 720
Else 'Si hay más de 40
.ItemsAcross = 2 'Adaptamos el ancho a 2 columnas
.ColumnSpacing = 50
.ItemSizeWidth = 4000 'Adaptamos el ancho de los controles
Me.Text0.Width = 1500
Me.Text1.Width = 500
Me.Text2.Width = 1000
Me.Text3.Width = 350
End If
End With
'Adaptamos la posición de los controles
Me.Text1.Left = Me.Text0.Left + Me.Text0.Width + 20
Me.Text2.Left = Me.Text1.Left + Me.Text1.Width + 40
Me.Text3.Left = Me.Text2.Left + Me.Text2.Width + 60
End Sub