I'm trying to use a Do...While loop (or possibly FOR loop) to loop through a table in my Access Database that will display a value of a specific field as it loops through the table.
I have a table (TableA) with 3 fields: (Field1, Field2, Field3).
When pressing a button, I want to loop through TableA, starting with the first record, and select Field3 and display it to the screen.
I'm thinking that I need to use a Do...While loop so it looks something like this:
I'm not too familiar with looping through code, just what I've seen posted here and there and the small microsoft examples I find from time to time. Any ideas on how to loop through a table and pull a specfic field to display until I reach the EOF?
Any help would be great!
I have a table (TableA) with 3 fields: (Field1, Field2, Field3).
When pressing a button, I want to loop through TableA, starting with the first record, and select Field3 and display it to the screen.
I'm thinking that I need to use a Do...While loop so it looks something like this:
Code:
Dim rs As Recordset
Dim UserField as String
Set rs = db.OpenRecordset("SELECT * FROM TableA")
Do While Not rs.EOF
rs.movefirst
UserField = ("SELECT Field3 FROM TableA")
Msgbox "Your results = " & UserField
rs.MoveNext
Loop
rs.Close
I'm not too familiar with looping through code, just what I've seen posted here and there and the small microsoft examples I find from time to time. Any ideas on how to loop through a table and pull a specfic field to display until I reach the EOF?
Any help would be great!