Table: Empty Fields

  • Thread starter Thread starter nl
  • Start date Start date
N

nl

How can I find all the empty fields in a table with over
100 fields, and it will tell which fields are those????

thank you:)
 
How can I find all the empty fields in a table with over
100 fields, and it will tell which fields are those????

thank you:)

Well, a table with 100 fields is almost surely incorrectly designed
anyway... <g>

There isn't any quick and easy way to do this. I assume you mean by
"empty field" a field for which that field is NULL for all the records
in the table. Just as a mental exercise, here's a little VBA module
which should do the job:

Public Sub FindEmptyFields(strName As String)
Dim db As DAO.Database
Dim td As DAO.Tabledef
Dim fld As Field
Set db = CurrentDb
Set td db.Tabledefs(strName)
For Each fld In td.Fields
If DCount("*", strName, "[" & fld.Name & "] IS NOT NULL") = 0 Then
Debug.Print "Field " & fld.Name & " is empty"
End If
Next fld
End Sub

Copy and paste this into a new Module, and type

FindEmptyFields("your-table-name")

in the Immediate window.
 
Back
Top