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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

For Each...Next query

Status
Not open for further replies.

mwheads

Programmer
Apr 24, 2004
38
0
0
ZA
Hi all

I've been trying to execute a FOR...NEXT for a an AccRef field in the tblBuildingdetails table but it won't work.
The min and max range of the AccRef is 0005 to 9999 but only about 300 of the AccRef's are in the table.
I managed to export 9994 txt files when I only want the 300 that exist.

I've tried the following but its not worked:

For Each i In tblBuildingDetails.AccRef
For Each i = dmin("AccRef","tblBuildingDetails") to dmax("AccRef","tblBuildingDetails")

thanks

Paul
 

Hi,

You want to open a recordset for the given table. Check help for the suitable parameters for opening a recordset.

Once opened, use the MoveFirst method to position the cursor at BOF.

Then the loop...
Code:
with YourRecordset
   Do Until .EOF
      'do stuff with YourRecordset("AccRef")
      .MoveNext
   Loop
end with


Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top