Using function to read Access table

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.
 
D

Dirk Goldgar

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top