April 2006
Beginner
1114 pages
98h 16m
English
recordset.EOF[= setting]
True if the current record position is after the last record in the recordset. The following code uses the EOF property to test for the end of the recordset, adding names from the Employees table in the Northwind Traders sample database to the first column of the current worksheet:
recordset.MoveFirst Dim strDbPath As String
Dim db As DAO.Database
Dim rs As DAO.Recordset
strDbPath = "C:\Program Files\Microsoft Office\OFFICE11\SAMPLES\Northwind.mdb"
Set db = OpenDatabase(strDbPath)
Set rs = db.OpenRecordset("Employees")
rs.MoveFirst
intIdx = 1
Do Until rs.EOF
strName = rs!FirstName & " " & rs!LastName
ActiveSheet.Cells(intIdx, 1) = strName
rs.MoveNext
intIdx = intIdx + 1
LoopRead now
Unlock full access