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
"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