I have a table called Tbl, and try to run this code on it. It will only list the data in the first row - what am I doing wrong!
Function e_num()
Dim dbs As Database
Dim fld As Field
Dim rst As Recordset
Dim i As Integer
i = 0
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Tbl", dbOpenSnapshot)
With rst
rst.MoveLast
rst.MoveFirst
Do While Not rst.EOF
Do While i < rst.Fields.Count
Set fld = rst.Fields(i)
MsgBox fld.Name & " = " & fld.Value
i = i + 1
Loop
rst.MoveNext
Loop
End With
End Function
Function e_num()
Dim dbs As Database
Dim fld As Field
Dim rst As Recordset
Dim i As Integer
i = 0
Set dbs = CurrentDb
Set rst = dbs.OpenRecordset("Tbl", dbOpenSnapshot)
With rst
rst.MoveLast
rst.MoveFirst
Do While Not rst.EOF
Do While i < rst.Fields.Count
Set fld = rst.Fields(i)
MsgBox fld.Name & " = " & fld.Value
i = i + 1
Loop
rst.MoveNext
Loop
End With
End Function