140. Access an Existing Database
135 Create a Database
You can use any database within Base or any other OpenOffice.org component if that database is registered as a
data source . Typically, when you create a database in Base, you register it so that it can be used as a data source by any OpenOffice.org component (see
135 Create a Database ). But what about databases that were created using some other program such as Calc, Microsoft Excel, Microsoft Access, or Thunderbird (an email program with an address database)? In this task, you'll learn how to register such a database so that you can use it whenever you want, throughout OpenOffice.org. For example, you can use a registered database in Base or in a Writer Mail Merge operation, or you can copy its data into a Calc spreadsheet.
After creating a database in Base,
do not follow these steps to open it again for editing. Instead, open an existing Base database from any OpenOffice.org component (and start Base at the same time) by choosing
File, Open or by clicking the
Open button. If you're not running OpenOffice.org right now, you can open an existing Base database by double-clicking the database file in Windows Explorer.
140. Access an Existing Database
76 Create a Calc Database ) within another OpenOffice.org component such as Base or Writer, you'll need to register it by following the steps given in this task.
After registering a foreign database (such as a Microsoft Access database) and converting it to Openoffice.org format, you can remove the original version from your system if you decide you don't need it. Choose
Tools, Options, OpenOffice.org, Databases. Select the database to remove and click
Delete.
1. | Click New, Database In any OpenOffice.org component, click the New button on the Standard toolbar and choose Database from the menu. Base starts and displays the Database Wizard. |
2. | Select Database Type In Step 1 of the Database Wizard , select Connect to an existing database. Select the type of database you want to register from the Database type list. In this example, I wanted to convert an Excel database for use in Base, so I chose Spreadsheet . You'd make this same choice to register a Calc database. Click Next . |
3. | Select Database In Step 2 of the Database Wizard , click Browse. Change to the folder that contains the database file you want to open, select it, and click Open. You're returned to the Database Wizard . If a password is required to access the database (if you or someone else password-protected the file), enable the Password required option. Click Next. |
4. | Register Database and Click Finish In Step 3 of the Database Wizard, select the Yes, register the database for me option. Disable the Open the database for editing option, unless you need to make changes to the database before you use it. If you do select this option, you might also be able to build the tables yourself, rather than letting OpenOffice.org create them by selecting Create tables using the table wizard option (if present). Click Finish . |
5. | Save the Database The Save As dialog box appears. OpenOffice.org will convert the database to Base format, register it for use, and save it in a new file. Select the folder in which you want to store the new database, and enter a name in the File name box. Base automatically adds the extension .odb to the filename. Click Save. The converted database is saved, and it can now be used within any OpenOffice.org program. If you opted to edit the data source, the converted file is opened in Base so that you can make changes. |
6. | View Data Source To view any registered data source from within Calc, Writer, or Impress (if you're creating a spreadsheet slide), choose View, Data Sources or press F4 . The Data Source pane appears above the document window. Click the plus sign in front of the data source you want to use. Click the plus sign in front of Tables , and the tables in the database are listed. Click one of these tables to view its data. |