Sub testfldprintvalue()
Dim dbs As DAO.Database
Dim rst As DAO.Recordset
Dim tdf As TableDef
Dim fld As Field
Dim Changes As Integer
Dim strtable As String
On Error GoTo fjTdfRst_Error
strtable = "somecsv" '[COLOR="SeaGreen"][B]<<<Your tablename goes here[/B][/COLOR]
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset(strtable) 'open the recordset (data)
Set tdf = dbs.TableDefs(strtable) 'open the tabledef (definition)
While Not rst.EOF 'loop through the recordset
For Each fld In tdf.Fields 'loop through the fields
Debug.Print fld.name & ": " & rst(fld.name).Value 'print field name and value
If NOT IsNull(rst(fld.name).Value) Then
Changes = Changes + 1
Else
End If
Next fld
rst.MoveNext
Wend
End_loop:
MsgBox "Total non null fields is " & Changes
rst.Close
On Error GoTo 0
Exit Sub
fjTdfRst_Error:
If Err.number = 3021 Then
MsgBox ("Error # " & str(Err.number) & " implies no data in table " & rst.name)
End If
MsgBox "Error " & Err.number & " (" & Err.Description & ") in procedure "
End Sub