Microsoft Access: Programmatically retrieve the number of columns in an Access table

Platform:Microsoft Access
Task:Programmatically retrieve the number of columns in an Access table
Discussion:
You need to have the database tell you, on the fly, how many columns are in a database table. Use the recordset's field.count() method. Example below:
Example:
Set rs = CurrentDb.OpenRecordset("SELECT * FROM tluParkCode;", dbOpenDynaset)
MsgBox("There are " & rs.Fields.Count & " columns in the table")
Back to Index