help with a loop

buggy2

Board Regular
Joined
Feb 28, 2003
Messages
69
i have a large table in my database called 'mytable'. it has 26 fields. i would like to loop through and print via a message box to the screen all the values of the 3rd field in my table. Call the fields a1,b2,c3,........

In this case i need all the values from fields "c3".
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Try this

Assuming this is a DAO database, goto tools references and make sure the Microsoft 3.6 Object Library is checked. Then put this code behind a button on the form.

dim db as dao.database
dim rs as dao.recordset
set db=currentdb()
set rs=db.openrecordset("select c3 from Mytable")
while not rs.eof
msgbox rs![c3]
rs.movenext
wend
db.close
 
Upvote 0

Forum statistics

Threads
1,221,525
Messages
6,160,327
Members
451,637
Latest member
hvp2262

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top