Using function to read Access table

  • Thread starter Thread starter Steve
  • Start date Start date
S

Steve

Ok, I have been away from this for quite some time now. I
am using Access 2003 and trying to find code snipits that
show me how to, within an single access database, open and
read a table. I want to be able to do a movefirst, look
at the contents, take some action, movenext and repeat the
cycle until I have reached the end of that table.
Everything I seem try has me just on the edge of a
breakthrough. But, quite honestly, the newer version
doesn't handle accessing tables the way I was accustom to
using recordsets or dynasets a few years ago. Any help
would be greatly appreciated.
 
Steve said:
Ok, I have been away from this for quite some time now. I
am using Access 2003 and trying to find code snipits that
show me how to, within an single access database, open and
read a table. I want to be able to do a movefirst, look
at the contents, take some action, movenext and repeat the
cycle until I have reached the end of that table.
Everything I seem try has me just on the edge of a
breakthrough. But, quite honestly, the newer version
doesn't handle accessing tables the way I was accustom to
using recordsets or dynasets a few years ago. Any help
would be greatly appreciated.

Dim rs As DAO.Recordset

Set rs = CurrentDb.OpenRecordset("MyTableName")
With rs
Do Until .EOF
MsgBox "Current record ID field = " & !IDField

' ... do something in here involving the fields.
' ... Field named "Field1" can be accessed as !Field1
' ... or as .Fields("Field1")

.MoveNext
Loop
.Close
End With
Set rs = Nothing
 
Back
Top