opendatabase
opendatabase
DATABASE

The opendatabase statement opens a database file.

Parameters

This statement has one parameter:

database – identifies the database you want to open. If the database is not in the same folder as the current database, you must specify the entire path name in addition to the file name.

Description

This statement opens a database. If the database is in the same folder as the current database, only the database name is needed.

    opendatabase "Accounts Receivable"

If the database is in a different folder, the entire path must be specified.

    opendatabase "~/Documents/Accounting/Accounts Receivable"

If the database (or one with the same name) is already open, it won’t be opened a second time. However, Panorama will bring forward a window belonging to the database (if the database has any open windows, if not, you will need to use the opensavedwindows statement).

#### File Extensions

All Panorama X databases have a file extension of `.pandb`. You can include this extension, or leave it off. Both of the lines below work exactly the same.

    opendatabase "Mailing List.pandb"
    opendatabase "Mailing List"

#### Custom Database Initialization

If the database contains a procedure named `.Initialize`, that procedure will run before any code following the opendatabase statement. Essentially it is as if there was a call statement after the opendatabase statement, like this:

    opendatabase "Mailing List"
    call .Initialize
    ...
    ... additional code
    ...

But don’t actually put in a call statement like this, otherwise the `.Initialize` procedure will be called twice! For more information, see Custom Database Initialization.

#### Opening a Database on Panorama X Server

If you are writing code to run on Panorama X Server (for web publishing), don’t use the opendatabase statement. Instead, you must use the openserverfile statement.

#### Opening a Panorama 6 Database

This statement can also be used to open a Panorama 6 database. To do that, the database filename must meet certain requirements:

- It must have an extension of `.pan`
- It must have been saved with Panorama 6 on an Intel based computer. Databases saved with Panorama 5.5 or earlier, or with Panorama 6 on a PowerPC computer, cannot be opened by Panorama X.

When opening a Panorama 6 database with the opendatabase statement, the `.pan` extension must be included when specifying the file name.

    opendatabase "Address Book.pan"

When opening a Panorama 6 database, Panorama X actually opens a copy of the database in Panorama X format. Any changes are made to that new copy – the original Panorama 6 database cannot be modified by Panorama X.

See Also

- Auxiliary Databases -- automatically opening multiple databases associated with each other.
- closefile -- closes the current database.
- closeserverfile -- closes the current database (used on the server).
- Custom Database Initialization -- using an .Initialize procedure to automatically run custom code when a database opens.
- Database Integrity Checks -- checking database integrity when opening and saving.
- Database is Damaged Alert -- how to fix the "database is damaged" alert when opening a database.
- openfile -- opens a database file. It can also import data from a text file, another database, or a variable into the current database.
- opensavedwindows -- opens windows that were open the last time file was saved.
- opensecret -- opens a database invisibly, without opening its windows.
- openserverfile -- opens a database (used on the server).
- opentextfile -- imports data from a text file or a variable into the current database.
- panoramastartupdatabases -- opens any databases specified for startup.

History

Version | Status | Notes
10.0 | Updated | Carried over from Panorama 6.0, but now also supports opening both Panorama X and Panorama 6 databases.