I need to link to or copy MS Access macros from a "master" database to MS Access pers

المشرف العام

Administrator
طاقم الإدارة
I need to link to or copy MS Access macros from a "master" database to MS Access pers

Here's my situation:I'm a python and arcpy novice. I’ve been cannibalizing and modifying code from different sources into a work in progress. Development is in ArcGIS 10.1 and will need backwards compatibility to 10.0 (not my choosing).

My current workflow is a bit clunky, but it does work. The user opens a template mxd. The first arcpy script in the toolbox sets up a uniquely named user specified project case folder and saves the template mxd to that folder with a similar unique name as the project folder. The next tool sets up a personal geodatabase in the project folder, copies in polygon features selected from a base polygon layer, and zooms to an AOI specified by those selected base polygons. With subsequent tools, the user digitizes, edits and attributes those polygon features in the project personal geodatabase in a couple of stages. Outcome is a polygon feature class whose attributes need to be incorporated into customized Access reports and Word documents for that case project. All’s mostly good to that point. The most important step is generating the reports and Word documents.

The customized reports and documents live in a separate “master” Access database. They’re controlled by a set of customized queries, forms and macros in the “master” database. What I want to do is use the functionality of those macros, etc. in the project geodatabase. But I’m having two issues:

1) How do I link to or copy those macros, etc. from the “master” to the project database directly from my arcpy script? I can open the project or “master” database with the subprocess.Popen module, but is there a way to code from the arcpy script the operation of linking or copying those macros etc. between the “master” and project databases?

AppPath = r"C:\Program Files (x86)\Microsoft Office\Office15\MSACCESS.EXE"

import subprocess

access = subprocess.Popen ([AppPath, personal_geodatabase_name])

2) The project Access database has a schema lock because I’m opening it from within an ArcMap session. So even if I can open it directly, I can’t edit in the access database. Is there a way to get around that schema lock?

There’s a lot packed into a few paragraphs here, and I hope it makes sense. The process is clunky, but mostly it works. If I can get the database side of it working it sure would make life easier.



أكثر...
 
أعلى