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

Batch processing a table

Status
Not open for further replies.

BusMgr

IS-IT--Management
Aug 21, 2001
138
US
I've create a subroutine that reads in the county and state from a table and returns the longitude and latitude of the centroid of that county. I did it with a form that does one record at a time, but now I want to do batch processing on the table. I have not done batch processing before, I understand the

"Do While Not rst.EOF"

part of the looping
but I do not understand the correct way to reference the database and the recordset.

Any help would be appreciated.

My code that I am trying to use is as follows:

Private Sub cmdMapCounty_Click()
Dim dbs As Database, rst As Recordset, tdfCurrent As TableDef
'Return reference to current database
Set dbs = CurrentDb()
Set rst = dbcurrent.OpenRecordset("tblHeader1", dbOpenDynaset)
Do While Not rst.EOF
DoCmd.SetWarnings False
'Purpose: To map location based on county and state Set oLocA = oMap.Find(County & " County, " & State)


'Declarations
Dim oApp As Object, oMap As Object
Dim oPush As MapPoint.Pushpin, oPushA As MapPoint.Pushpin
Dim oLoc As MapPoint.Location, oLocA As MapPoint.Location
'A Mile = 0.01471 Degrees of Lat/Long, a Half mile = 0.007355
Dim Measure As Double
Dim zLat As Double, zLong As Double, DistX As Double, DistY As Double, DistZ As Double
Dim PointX As MapPoint.Location, PointY As MapPoint.Location
Dim rad As Integer, alt As Integer, I As Integer
.
.
.
rst.movenext
loop
rst.close
dbs.close
end sub
 
You should not have any declarations (i.e. dimension statements) inside a loop. For that matter, there should be no code before declarations except other declarations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top