Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading rows in a table one at a time 1

Status
Not open for further replies.

demivolt

Programmer
Aug 21, 2001
13
0
0
US
Dear fellow members,
I need to loop through a table (or view created by a query) reading and processing one record at a time. I know this is possible but am experiencing a mental block on how to do it in VBA. Can anyone out there give me an example?
Much thanks,
Demivolt
 

Public Process_MyTable
Dim rs as recordset
Dim strSQL as string

StrSQL = “SELECT * FROM MYTABLE”
Set rs = currentdb.openrecordset (strSQL, dbopendynaset)
If rs.recordcount = 0 then
Msgbox “WHOOPS. TABLE IS EMPTY”,vbinformation
Exit sub
Endif
Rs.movefirst
While not rs.eof
Rs.edit
‘ DO YOUR UPDATING HERE
rs.update
rs.movenext
wend
rs.close
set rs = nothing
end sub
Robert Berman
Data Base consultant
Vulcan Software Services
thornmastr@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top