This code will quickly create a Form from your table or query. Form specs: continuous forms, column labels = field names, column widths= 1 in. (except for check-boxes), text boxes = flat with black border, everything is Arial 8 pt. To use it, go to the debug (immediate) window and type-in either:
Call BuildForm("my table name",acTable)
or
Call BuildForm("my query name",acQuery)
Option Compare Database
Option Explicit
Sub BuildForm(strSource, intSource)
Dim frm As Form, ctl As Control
Dim db As Database, fld As Field, obj As Object
Dim intType As Integer, intLeft As Integer, intWidth As Integer, intHeight As Integer, intTop As Integer
intLeft = 0: intTop = 0: intHeight = 240
'
Set db = CurrentDb
If intSource = acTable Then
Set obj = db.TableDefs(strSource)
Else
Set obj = db.QueryDefs(strSource)
End If
Set frm = CreateForm
With frm
.RecordSource = strSource
.DefaultView = 1
.Section(acDetail).Height = intHeight
DoCmd.RunCommand acCmdFormHdrFtr
.Section(acHeader).Visible = True
.Section(acHeader).Height = intHeight
.Section(acFooter).Height = 0
For Each fld In obj.Fields
Select Case fld.Type
Case dbByte, dbInteger, dbLong, dbSingle, dbDouble, dbCurrency, dbDecimal, dbFloat, dbNumeric
intType = acTextBox
intWidth = 1440
Case dbText, dbMemo
intType = acTextBox
intWidth = 1440
Case dbDate
intType = acTextBox
intWidth = 1440
Case dbBoolean
intType = acCheckBox
intWidth = 260
Case Else
intType = acTextBox
intWidth = 1440
End Select
'
Set ctl = CreateControl(frm.Name, intType, acDetail, , , intLeft, intTop, intWidth)
With ctl
.ControlSource = fld.Name
.Name = fld.Name
.SpecialEffect = 0
.BorderStyle = 1
If intType < > acCheckBox Then
.FontName = "Arial"
.FontSize = 8
End If
End With
'
Set ctl = CreateControl(frm.Name, acLabel, acHeader, , , intLeft, intTop, intWidth, intHeight)
With ctl
.Caption = fld.Name
.FontName = "Arial"
.FontSize = 8
End With
'
intLeft = intLeft + intWidth
Next fld
End With
End Sub