Originally posted by NeoPa
Labels are named in a similar way T0, T1, T2 etc for textboxes, L0, L1 for associated labels, H0, H1.. for header labels and as you may guess F0, F1 etc for the footer textboxes.
50 may seem to be overkill, but I have had occasions where that number is required.
All controls are visible, but left, top, width and height are all set to 0. Textbox control sources are left empty
All form views allowed are allowed.
This technique also works with .accde
The technique is similar to that used for dynamic reports based on crosstabs
in the form on load event, you have code along these lines
Code:
Private Sub Form_Load() Dim fld As DAO.Field Dim i As Integer Me.RecordSource = Me.OpenArgs 'pass name of query or sql in the openargs parameter of docmd.openform i = 0 For Each fld In Me.Recordset.Fields With Me("T" & i) .ControlSource = fld.Name .Move (i * (2000 + 60), 0, 2000, 300 'change these to suit positioning - 60 is a touch over 1mm and provides a margin between controls End With 'do the same for labels i = i + 1 Next fld End Sub
Comment