Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Private Sub cmdColumnSize_Click()
Dim rst As DAO.Recordset
Dim fld As DAO.Field
Dim sngWidth As Single
Dim strWidths As String
Dim intChars As Integer
Dim intCount As Integer
Set rst = CurrentDb.OpenRecordset(Me.lstTable.RowSource)
With rst
If .RecordCount > 0 Then
For Each fld In rst.Fields
intCount = intCount + 1
Select Case fld.Type
Case dbBoolean
intChars = 5
Case dbByte
intChars = 2
Case dbInteger
intChars = 10
Case dbLong
intChars = 10
Case dbCurrency
intChars = 14
Case dbSingle
intChars = 20
Case dbDouble
intChars = 14
Case dbDate
intChars = 20
Case dbText
intChars = fld.Size
Case dbLongBinary
intChars = 20
Case dbMemo
intChars = 255
Case dbGUID
intChars = 64
End Select
sngWidth = intChars * (20 * (lstTable.FontSize / 2)) / 1440
strWidths = strWidths & sngWidth & Chr(34) & ";"
Next
lstTable.ColumnCount = intCount
lstTable.ColumnWidths = strWidths
End If
End With
End Sub