ScottChang25

ArcGIS10.1:Using Access accdb table to do MakeXYEventLayer-Error732. Why?

Discussion created by ScottChang25 on Feb 1, 2013
Latest reply on Feb 6, 2013 by Wayne_Whitley
Hi all,

In my Access 2007, I created the following accdb file "APG10pointsMMRP.accdb" in my C:\Temp folder:
file_id      Pt_ID         X                 Y                Z         sample_id        Boring
5             BH1     -76.301725    39.392986        0.1              1              DH-3
6             BH-2   -76.300981    39.392928         0.2              2              DH-6
..             ....         ......             .....              ...               .               ....
14            WELL1  -76.382654   39.395984        1.1              10             DH-59

In the IDLE (Python GUI) of my ArcGIS 10.1, I executed the following script:
# scAPG10pointsMMRPMakeXYlayer.px  [X,Y-coodinates in the Access 2007 accdb for 10 points of boring locations]
# Description: Creates an XY layer and uses CopyFeatures to save it to a layer file (Used ArcGIS 10.1)
# Author: ESRI - modified by Scott Chang per Arkadiusz Matoszka & Wayne Whitley

# ******* This script was created and executed in ArcGIS 10.1 by Scott Chang on 1 Feb 2013 ******

# import system modules 
import arcpy
from arcpy import env
 
try:
    # Set the local variables
    # in_Table = "firestations.csv"
    tb = r"C:\TEMP\APG10pointsMMRP.accdb\Table1"
    xc = "X"
    yc = "Y"
    zc = "Z"

    out_Layer = "Pointlocations_layer"
    saved_Layer = r"c:\TEMP\APG10pointsMMRPaccdb.shp"    # not .layer!!!
 
    # Set the spatial reference
    # spRef = r"Coordinate Systems\Projected Coordinate Systems\Utm\Nad 1983\NAD 1983 UTM Zone 11N.prj"
    spRef = r"Coordinate Systems\Geographic Coordinate System\World\WGS 1984" 
 
    # Make the XY event layer...
    arcpy.MakeXYEventLayer_management(tb, xc, yc, out_Layer, spRef)
 
    # Print the total rows
    print arcpy.GetCount_management(out_Layer)
 
    # Save to a layer file
    # arcpy.SaveToLayerFile_management(out_Layer, saved_Layer)
    arcpy.CopyFeatures_management(out_Layer, saved_Layer)       # New!!!

except:
    # If an error occurred print the message to the screen
    print arcpy.GetMessages()




It did not run and I got Error 732 - see the attached file for details.

I guess the following code statement is wrong:
tb = r"C:\Temp\APG10pointsMMRP.accdb\Table1"

But I don't know how to correct it.  Please help and advise.

Thanks,
Scott Chang

Outcomes