M
Marian M.
I need to create a batch file with ~6000 lines in it for ArcGIS. Python is
beyond me, so I'm trying to do this with VBA in an Access module using hints
I've found through this discussion group (VBA is what I know how to use).
Each line should be:
Intersect_analysis "C:\FICE93_25\strID.shp #;'C:\LSAY\Census\SHPs\1990\1990
Block Groups\BlkGrp90_Albers.shp' #" C:\FICE93_25\strID_Intersect.shp ALL #
INPUT
I've broken the line into 4 parts, strStart, strMid, strEnd & strID, using
the code at the end of this message. The problem is, I get "Compile error:
Expected: end of statement" for strStart & strMid. MS VBA doesn't seem to
like the 'C:' in "C:\FICE93_25\". What am I doing wrong? (since I can't get
beyond those two lines, I don't know how well the rest of the code works)
TIA,
Marian
the code:
--------------
Sub MyBatchFile()
Dim strStart As String, strMid As String, strEnd As String, strID As String
Dim iLoop As Long
Dim dbs As Database, rsID As Recordset
Set dbs = CurrentDb
' Set the path to the directory where the files will be.
For iLoop = 1 To 5945
Set rsID = dbs.OpenRecordset("Select FICE93_ID From AdYrLists Where
FICE93_ID = " & iLoop)
strID = rsID!FICE93_ID ' Set the first state string
strStart = "Intersect_analysis " & """ & "C:\FICE93_25\"
strMid = ".shp #;'C:\LSAY\Census\SHPs\1990\1990 Block
Groups\BlkGrp90_Albers.shp' #" & " "" & "C:\FICE93_25\"
strEnd = "_Intersect.shp ALL # INPUT"
strSQL = strStart & strID & strMid & strID & strEnd
strQ = "BatchLine"
Set qdf = dbs.CreateQueryDef(strQ, strSQL)
qdf.Close
DoCmd.TransferText acExportDelim, "AdYrLists ExSpec", qdf.Name,
"C:\LSAY\MigrPath\FICE93_25.txt"
dbs.QueryDefs.Delete strQ
Set qdf = Nothing
Next iLoop
End Sub
------------
beyond me, so I'm trying to do this with VBA in an Access module using hints
I've found through this discussion group (VBA is what I know how to use).
Each line should be:
Intersect_analysis "C:\FICE93_25\strID.shp #;'C:\LSAY\Census\SHPs\1990\1990
Block Groups\BlkGrp90_Albers.shp' #" C:\FICE93_25\strID_Intersect.shp ALL #
INPUT
I've broken the line into 4 parts, strStart, strMid, strEnd & strID, using
the code at the end of this message. The problem is, I get "Compile error:
Expected: end of statement" for strStart & strMid. MS VBA doesn't seem to
like the 'C:' in "C:\FICE93_25\". What am I doing wrong? (since I can't get
beyond those two lines, I don't know how well the rest of the code works)
TIA,
Marian
the code:
--------------
Sub MyBatchFile()
Dim strStart As String, strMid As String, strEnd As String, strID As String
Dim iLoop As Long
Dim dbs As Database, rsID As Recordset
Set dbs = CurrentDb
' Set the path to the directory where the files will be.
For iLoop = 1 To 5945
Set rsID = dbs.OpenRecordset("Select FICE93_ID From AdYrLists Where
FICE93_ID = " & iLoop)
strID = rsID!FICE93_ID ' Set the first state string
strStart = "Intersect_analysis " & """ & "C:\FICE93_25\"
strMid = ".shp #;'C:\LSAY\Census\SHPs\1990\1990 Block
Groups\BlkGrp90_Albers.shp' #" & " "" & "C:\FICE93_25\"
strEnd = "_Intersect.shp ALL # INPUT"
strSQL = strStart & strID & strMid & strID & strEnd
strQ = "BatchLine"
Set qdf = dbs.CreateQueryDef(strQ, strSQL)
qdf.Close
DoCmd.TransferText acExportDelim, "AdYrLists ExSpec", qdf.Name,
"C:\LSAY\MigrPath\FICE93_25.txt"
dbs.QueryDefs.Delete strQ
Set qdf = Nothing
Next iLoop
End Sub
------------