HOW TO

Avoid problems with SQL when double-clicking an APR file.

Last Published: April 25, 2020

Summary

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.

Procedure

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.

  1. Start a new ArcView project.
  2. Open a new script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  3. Copy the following code into the script window.

    Code:
    '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
    ' end
    ' 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
    ' end
    ' end
    'end
    theFName = "Insert path to real APR".asfilename
    if (nil <> theFName) then
    if (nil <> theProject) then
    theProject.Close
    end
    theProject = nil
    av.ClearGlobals
    av.DelayedRun("Project.OpenPart2", theFName, 0)
    end
    'End of Script

  4. 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
  5. Compile the script by clicking the compile button.
    [O-Image] Script compile button
  6. 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.

  7. Save this project.
  8. Exit ArcView.
  9. Using Windows Explorer, double-click the APR file created in Step 1.

Article ID:000005226

Software:
  • Legacy Products

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic