Select to view content in your preferred language

MakeFeatureLayer fails with lyr file

763
2
09-11-2010 03:31 AM
StevePeaslee
Deactivated User
I have a layer (.lyr) file created using a shapefile joined to a MS Access table (registered with OBJECTID). The layer file works fine in ArcMap when using the Add Data button but fails with a useless error message when using MakeFeatureLayer (tool or script). This behavior occurs under 9.2 and 9.3.1.

No problems occur when the layer file is created using join between a gdb featureclass and table. Has anyone else gotten this to work? Converting the shapefile to a gdb featureclass is not an option. I need to be able to work with the data as is.

-Steve
0 Kudos
2 Replies
ChrisSnyder
Honored Contributor
What ArcMap version was the .lyr file created with? Generally, the .lyr files are version-sensitive and not backwards compatible.

Other than that, I'm not sure why it wouldn't work... It's not a composite layer (made up from more than one GIS layer), right?

You could just recreate anew it your script (MakeFeatureLayer, AddJoin)... That's what I do (rather than using a .lyr as the data source).
0 Kudos
StevePeaslee
Deactivated User
Chris, thanks for the reply.

Everything is done (creating featurelayers and lyr files) using the same version of ArcGIS, in fact it is all done within the same script. I was mainly trying to see if anyone else had run into this problem (it's easy enough to test) and if so I might submit it as a bug. If nothing else a better error message would be useful.

I can work around the problem as you suggest but would prefer to find a way to get the lyr file with the join to work properly with MakeFeatureLayer.

-Steve
0 Kudos