Attribute VB_Name = "basMaxLen" Option Compare Database Option Explicit Public Function CountLen(ByVal tbl As String, ByVal fld As String) As Integer 'Count the Max len of characters in a given field 'Declare your connection and recordset Dim cnConn As ADODB.Connection Dim rsTable As ADODB.Recordset 'Set your connection to the current project 'Set your table to a new ADO recordset Set cnConn = CurrentProject.Connection Set rsTable = New ADODB.Recordset 'Open your table - in this case tblNames rsTable.Open tbl, cnConn, adOpenForwardOnly, adLockReadOnly 'Move to the first record and loop through them to the end 'displaying each one in the Immediate window Dim i As Integer i = 0 rsTable.MoveFirst Do Until rsTable.EOF If Len(rsTable.Fields.Item(fld)) > i Then i = Len(rsTable.Fields.Item(fld)) End If rsTable.MoveNext Loop CountLen = i 'Clean up your variables rsTable.Close cnConn.Close Set rsTable = Nothing Set cnConn = Nothing End Function