How To: Avoid problems with SQL when double-clicking an APR file.
Problems can occur when opening a project that references SQL tables if it is opened by double-clicking the APR file. The SQL connection is attempted before ArcView is fully initialized and errors may occur.
The recommended method for opening projects is to start ArcView, select File > Open Project and select the project you wish to open.
Use the following method if a project must be opened by double-clicking the APR file. This process uses the startup script of one project to start the project with the SQL connection.
- Start a new ArcView project.
- Open a new script window. A. Activate the Project window.
B. Click the Scripts icon.
C. Click New.
- Copy the following code into the script window.
'This code is modified from the Project.Open System script.
theProject = av.GetProject
'if (nil <> theProject) then
'if (theProject.IsModified) then
' if (av.Run("Project.CheckForEdits",nil).Not) then
' return nil
' res = MsgBox.SaveChanges("Do you want to save changes to "
' + theProject.GetName + "?", "ArcView", true)
' if (nil = res) then return nil end
' if (res) then
' av.Run("Project.Save", nil)
' if (theProject.IsModified)then return nil end
theFName = "Insert path to real APR".asfilename
if (nil <> theFName) then
if (nil <> theProject) then
theProject = nil
av.DelayedRun("Project.OpenPart2", theFName, 0)
'End of Script
- Change 'theFName' variable to point to the real project. For example, if the real project was stored as c:\home\project1.apr the line of code would look like this:
theFName = "c:\home\project1.apr".asfilename
- Compile the script by clicking the compile button.
- Specify the new script as the startup script of this project. A. With the project window active, select Project > Properties.
B. Enter the name of the new script in the 'StartUp' text box in the Project Properties dialog box.
C. Click OK.
- Save this project.
- Exit ArcView.
- Using Windows Explorer, double-click the APR file created in Step 1.