Comparison of OpenOffice Base with Access
November 18, 2008 Elaine Rica Torres
PLUGIN T6 Access and Base have the same database objects: Tables, Forms, Queries, and Reports. Creating a New Blank Database (p. T6-4) The Access welcome screen lets the user create a new database by selecting the Blank Database icon and the naming the Database in the text box on the right side of the welcome screen. The database is created after clicking Create. After the database is created, a new empty table (Table1) appears in Datasheet View and the user can begin entering data. In Base, a new database can be created by selecting File > New > Database. A wizard appears that walks the user through the creation of a new database. When the user selects “Create a new database” and then clicks Next, the wizard asks if the user wants the database to be registered on OpenOffice.org:
If “Yes” is selected, this simply means that the database will be stored in a list under Tools > Options > OpenOffice.org Base > Databases. This makes it available as a data source to other OpenOffice application. Registering your database tells the OpenOffice.org suite where it is located on your computer. It will not register or make the database available online, as implied by the prompt.
In the wizard, the user is also asked if she wants to create tables right away once the database is created. If “Create tables using the table wizard” is selected, a wizard to create tables will appear after Finish is clicked. Templates (p. T6-5) Base doesn’t have templates. OpenOffice offers some extensions that include templates for their other applications, but I don’t think they have templates for Base. Access users can take advantage of database templates that contain predefined tables, forms, reports, queries, macros, and relationships. All the user has to do is enter the data; whereas the closest thing Base has to a template is a sample table that users can select when creating a table from the wizard. These sample tables have pre-defined field names and users can select which fields they want to include in the table. Other objects related to the table such as forms, queries, and reports are not automatically included. For example, here is Access’ Contacts template. When run, a ready made form comes up for the user to fill out.
Included in the template is a table of the data entered in the form, a report that shows the contacts’ addresses and another report that shows the contacts’ phone numbers. There is also a query that is used by the aforementioned reports to file the contacts alphabetically by last name. In Base, when the user chooses to create a table using the wizard, she can select from a list of sample tables that have pre-defined field names. Base has a Contacts sample table similar to Access’ Contacts template.
Through the wizard, the user is asked to select from a list which field names she wants to include in her Contacts table.
However, only a table is provided. If the user wants to have forms, queries, and reports similar to the ones in the Access Contacts template, she would have to create these herself one by one. Database Window and Object Views (p. T6-6) The Access database window:
All objects are accessible through the navigation pane. Double-clicking an object opens the object. Right-clicking the object gives the user options to copy, rename, edit, or delete the object, among other things. The Base workspace layout:
This is the view when a database is opened. It also has a navigation pane on the left to navigate among tables, queries, forms, and reports. When an object is selected, a view of the object is 5
shown on the right. Right-clicking the objects give the option to copy, delete, rename, edit, or open the object. Object is opened in a new window. Table Views (p. T6-7) With Access, the user can change how a table is viewed by clicking the View button and selecting the type of view. Datasheet view is used for entering data into the table. Design view is used to modify the structure or properties of the table. With Base, the default view when opening a table is similar to Access’ Datasheet View. To enter data into the table, simply open the table. By right-clicking the table and selecting edit, the table structure and properties can also be modified using a similar interface as Access’ Design View. CREATING AND MODIFYING TABLES In Access, there are two ways to create tables, which is by using data entry or by using design view. In Base, the two ways to create tables is by using the wizard or also by using design view. Using data entry in Access (p. T6-8) To create a simple table in Access using data entry, the user clicks on the Create tab and then selects Table. A new table appears and the user simply enters the data. The user can change the field names by double-clicking the default field name (Field1, Field2, etc.) New fields can be added by entering data under the “Add New Field” column.
Using the wizard in Base As discussed under TEMPLATES earlier, the user can use the wizard in Base to select from sample tables with predefined field names. These can be customized later by editing the table in design view. Using design view in Access vs. Base (p. T6-9) Through design view, the user can create new tables by specifying field names, properties, and data types. In Access, to create a new table using design view, the user opens the Create tab and selects Table Design. A new table is created in Design View where the user enters field names and the corresponding data types and descriptions. The properties of each field can also be modified in the Field Properties pane. The primary key field can be designated by opening the Design tab and then clicking on the Primary Key icon. Access Table Design View:
In Base, to create a new table using design view, the user selects the “Create table in design view” option under Tasks in the workspace pane. Design View opens in a new window. The user inputs field names and the corresponding field types and descriptions. To designate the primary key field, right-click on the field name(s) and select primary key. Base Table Design View:
The Access and Base Design Views have similar interfaces, but Base has different data types (called ‘field types’ in Base) than those of Access. Base has no Currency field type, so we can use the Decimal field type instead. The modifiable properties for each field are also less. For
example, under the Numeric field type, the only modifiable properties are length, decimal places, default value, and format example. Data/Field types (p. T6-11) Access Base Text TinyInteger Memo BigInt Number Image Date/Time Binary Currency Memo AutoNumber Text Yes/No Number OLE Object Decimal Hyperlink Integer Attachment Small Integer Float Double Yes/No Date/Time Input Mask and Format Property (pp. T6-11 to T6-13) In Access, input masks can be created for Date or Text data types. Creating an input mask ensures that data is entered in a particular format. When clicking the Input Mask box under the Field Properties pane in Design View, a wizard appears in which the user can select the most common data formats (password, phone number, short date, etc.). Users can also edit or create new input masks by clicking “Edit List” in the wizard.
Base has no such thing as input masks, but the format of date and numeric data can be specified using the Format Example box under the Field Properties pane in Design view. This is similar to Access’ format property also under Field Properties in Design View.
Base Format Example wizard:
Access Format property box:
With no input mask feature, Base is limited to formatting date and numbers only. However, in Base, the user can also create new formats similar to input masks using the Format Example wizard by editing the text box under â€œFormat code.â€? Here the user can enter a sample format that the data in the table should follow. Clicking the check mark beside the text box files the newly created format under the User-defined category. DEFINING RELATIONSHIPS (pp. T6-13 to T6-15) Access When the same field name appears in two different tables, Access automatically creates a one-tomany relationship between the common fields. But users can also define relationships between fields with different names using the Relationships window.
To begin, make sure there are no tables opened. The Relationships window can be opened by selecting the Database Tools tab, and then clicking on Relationships. The Show Table dialog box appears in which users select which tables to define relationships for. After adding the tables, the user selects the primary key in the first table and then drags it into another tableâ€™s foreign key. The Edit Relationships dialog box appears. Checkmark Enforce Referential Integrity, then click Create. The Relationship is created. Note that fields should have the same data type. To edit a relationship, double click on relationship line. The Edit Relationships dialog box appears where you can change the relationship features. To delete, click on a relationship line to select it and then click Delete. Base In Base, the relationships window is opened through Tools > Relationships. Relationship diagram opens in new window. Similar to Access, the user is prompted to add which tables to define relationships for. Select which tables to add, click Add, then close dialog box. Relationship is created also by dragging primary key in first table to the foreign key in another table. A similar Edit Relationships dialog box appears but the options are different:
Base doesn’t have a checkbox to Enforce Referential Integrity. In Base, to edit or delete relationships, right-click on the relationship line then select Edit or Delete. USING T6 FOR OPENOFFICE BASE So far, I can see that Base is also capable of most of the Access features shown in T6. Base has some limitations, such as its lack of complete templates and input masks, but Base users can easily work around this by using Base’s sample tables in place of templates and using the Format field property instead of input masks. Students using Base would also have to make some minor adjustments such as the example I gave of using the Decimal field type in lieu of Access’ Currency data type. I do think that for simple databases with simple tables, Base is enough to replace Access. I find that Base is actually simpler and easier to use, because its features are very basic and we might say are just the “bare necessities” of database creation. Access may have much more features, although not all these features are really necessary to create a simple database (such as the Validation Rule field property). In other words, a useful database can still be created without these excess features. If Base users used T6, I think they would be able to walk through the whole plugin without much difficulty.
PLUGIN T7 QUERIES Both Access and Base have the query feature. Two ways to create queries in both applications are by using the Query Wizard or by using Design View. CREATING SIMPLE QUERIES Query Wizard (p. T7-2) Access In Access, the wizard can be used to make simple queries. The wizard allows the user to create a select query; that is, a query that simply displays the fields that the user selects. The wizard simply asks which fields to include in the query and if the records are to be shown in detailed or summarized view. To sort or filter records, the query has to be modified in Design View. Base
In Base, the Query Wizard is basically the same as the Access Query Wizard. However, the Base wizard has more steps that the Access wizard doesn’t have. These steps let the user define the sorting order, specify search conditions, and change the field names. To create a simple query using the Base Query Wizard, click on the Queries icon in the left pane then select “Use Wizard to Create Query.” After asking the user to select which fields she wants the query to show, the wizard asks the user how to sort the records:
The next step allows the user to specify search conditions, which in effect filter the records shown in the query:
The next step, like in the Access wizard, asks the user if she wants a detailed or summarized view of the data. After clicking Next, the user may change the field names of the query if desired. The final step of the wizard, like in Access, lets the user name the query. In addition, an overview is given of the options selected from the previous steps:
Reordering columns (p. T7-3) 14
In Access, when the query is in datasheet view, the user may change the position of a column by clicking the field name to highlight the column, and then clicking it again and dragging it to the desired position. In Base, when the same actions are performed, nothing happens. To reorder columns in Base, double-click on the field name. Click it again then drag the column to the desired position. Design View (p. T7-4) Simple queries can also be created using Design View in both Access and Base. The procedure is the same in both applications. To open Design View in Base, click on Queries on the left pane then select “Create Query in Design View.” The Add Table dialog box will appear and the user selects which tables to include in the query. When done adding tables, the user then selects the fields she wants the query to show, by double-clicking those field names in the field lists. The query is run by clicking on the Run Query button on the toolbar:
Adding selection criteria to a query (p. T7-5) Using Design View The queries created above were select queries, in that they show the fields you specified for the query to show. By default, all records are displayed. However, by modifying the query in Design View, you can add some criteria so that only specific records show. Queries made through the wizard can also be modified using Design View. For example, in the Bike List query, we can specify for the query to show only those bikes that are rented for below $15. Specifying this criterion in Base can be done through the wizard (in the third step, “Search conditions”), but it can also be done in Design View. To do this, open in Design View the query you want to modify (right-click it in the query list and select Edit).
Access Query Design View:
Base Query Design View:
Access and Base basically have the same Query Design View so the procedure is not that different. Add the field you want to specify a criterion for by double-clicking it in the field list. In the example in p. T7-5, the “Cost Per Hour” field is added and “<15” is entered in the criterion row. When the query is run, it will only show those records with a Cost Per Hour that is less than $15. Removing the checkmark on the “Visible” row in the Base Design View will hide the query field when the query is run in datasheet view (this is the same as the “Show” row in Access). Sorting Data (p. T7-6) The way the records are sorted can be specified in Design View in both Access and Base, but the sorting order can also be controlled when the query is already in datasheet view. This can be done in Base by clicking on the sort buttons on the toolbar. In Access, the sort buttons can be found under the Home tab and in the Sort & Filter group. ADVANCED QUERIES 16
Calculated fields (p. T7-7) With Access and Base, you can add to a query a new field that displays a calculated value based on the data from other fields. To create a calculated field, a formula must be entered in the Field row in Design View. However, the way that the formulas are written in Access differs from that in Base. Access The example in p. T7-7 is: Rental Amount: ([TimeIn]-[TimeOut])*24*[Cost Per Hour] Opening and closing brackets are used when referring to the other field names in the query. When a query with this formula is run in datasheet view, a new field with the name “Rental Amount” is created. The data type of TimeIn and TimeOut is Date/Time, so [TimeIn]-[TimeOut] is calculated in terms of days. The result is then a fraction of a day. We multiply the difference of TimeIn and TimeOut by 24 to convert the result into hours, so that we can multiply it by Cost Per Hour to get the Rental Amount total. Base When the formula above is entered in Base’s query Design View, the following warning appears:
In Base, we enter the formula in the Field row without a given field name. The field name is entered below the Field row, under Alias (Access’ Design View doesn’t have this row). Base uses double quotation marks to refer to field names instead of brackets. The formula to be entered in the Field row in Design View would be: DATEDIFF( 'hh', "TimeOut", "TimeIn" ) * "Cost Per Hour" Mathematical operations cannot be applied to date and time in Base. SQL commands are used. To do the calculation in p. T7-7, we use the DATEDIFF function which returns the elapsed time from “TimeOut” to “TimeIn”. In the formula, ‘hh’ indicates that we want the result to be calculated in terms of hours. This means we don’t need to multiply the DATEDIFF result by 24, instead we multiply it directly by the Cost Per Hour.
Using the expression builder (p. T7-8) 17
Base doesn’t have anything like Access’ Expression Builder. Using the Expression Builder, you wouldn’t have to type the formulas for the calculated fields. You just select the field names and operations that you want to use. In Base, the only way to write formulas is by manually typing it. Using aggregate functions to calculate totals in queries (p. T7-8) Queries in both Access and Base have aggregate functions which are used to calculate totals of records. In Access, when in Query Design View, clicking on the Totals button in the toolbar will add the Totals row to the design grid. In this row we can select from a dropdown menu how to aggregate records in a certain field. Access can group records and calculate the sum, average, minimum, maximum, count, variance, and standard deviation of the total records. In Base these functions can be found in the Function row of the design grid. Base has the same aggregate functions as Access except for variance and standard deviation. To make this row visible in Design View, click on the Functions button on the toolbar:
Formatting results displayed in a calculated field (p. T7-9) Just like records in any regular field in a table, results from calculated fields in Access can be formatted. In Design View, right-clicking on the formula and then selecting Properties will open the Property Sheet. In the Format box we can specify the format. In Base, the query has to be run first. When the query shows up with the results, right-click on the field name of the calculated field then select Column Format. This will bring up the Field Format dialog box where we can define or select a format. Creating and running queries to modify data (p. T7-10) In Access, queries can be used to modify data in a table. Queries used to modify data are called action queries and there are four types: Make Table, Append, Delete, and Update queries. To create such queries in Design View, select any of the four under Query Type in the toolbar. The Query Design View in Base does not support modifying data. We need to use the SQL view to create action queries. USING T7 FOR OPENOFFICE BASE For simple queries, Base users will easily be able to follow the steps described in T7. Only the mouse functions in reordering columns are different. Also, Base users would have to remember that Design View in Base is opened by right-clicking on a query in the query list then selecting Edit. The query wizard and query design view in Base are otherwise very similar to Access. For advanced queries, however, Base differs greatly. Base users will be able to do what is shown in T7, but the steps described in the plugin cannot be followed. Creating advanced queries in Base is more complicated because it requires SQL knowledge. SQL commands are also used in Access but Access users can get by without it; SQL is not even mentioned in the plugin. In Base, in order to create the advanced queries presented in T7, SQL is necessary. PLUGIN T8
FORMS Creating a form using the form wizard (p. T8-3) Forms can be created through the wizard. However, the form wizard in Access and Base differ even more so than the query wizard. The Access form wizard is simpler and quicker than Base. The Access form wizard has four steps: • Field selection, where we select the fields we want to include in the form. • Layout selection, where we can choose among a columnar, tabular, datasheet, or justified layout for the form. • Style selection, where we are given a wide range of style templates to choose to apply to our form. • Naming of the form. Access Form, using the Civic AutoFormat template:
The Base form wizard prompts us for more details. • After field selection, we are asked if we want to set up a subform. If we decide to add a subform, the wizard will ask a few more questions relating to the subform. Otherwise it will go to the next step. • The next step is arranging of controls. This is similar to the layout selection in Access. We can choose from Columnar with labels on left, Columnar with labels on top, Datasheet, or In Blocks with labels on top. • Then we are asked to set the data entry mode. This means whether we want the data from its corresponding table to appear on the form, or if we want to make it a blank form simply entering new data. (In Access, data is automatically displayed on the form when the wizard is finished.) In this step we are also given the option to allow data modification through the form. • In the next step we can choose the background color and whether we want flat, 3D, or noborder text boxes on the form. Base does not have style templates for forms like Access does. • The final step is naming the form. Base Form, using Ice Blue as background color and 3D borders for text boxes:
Accessing several tables or queries in a form (p. T8-3) In Access we can include in the form fields from more than one table or query. In the form wizard, after selecting fields from one table, select another table from the dropdown menu and add the desired fields. When we follow the same steps in Base, the previously selected fields disappear. Fields from only one table or query can be added. There is a way around this, however, which is to first create a query that combines the data from several tables. We can then create a form based on this query. Creating and saving forms (p. T8-4) In Access we can create a simple form just by the click of a button. While a table is selected in the left navigation pane, clicking the Form button in the Create tab will create a columnar form that includes all the fields from the selected table. Any linked tables are also displayed as a subform. Base doesnâ€™t have such a feature that instantly creates forms. The two ways to create a form in Base is using the wizard and using Design View. The form wizard would be the easiest and quickest way to create a simple form that includes all fields from a certain table or query. Modifying the properties of a form (p. T8-5) Once it is created, a form can still be modified through the Access and Base Design Views. To edit a form in Base using Design View, right-click on the form in the form list and select Edit from the right-click menu. Access has an AutoFormat function which allows us to choose a format template for our form. The AutoFormat button can be found under the Arrange tab when the form is in Design View. Clicking this button will show us a variety of styles to choose from, which can be instantly applied to our form.
Base has no such templates of form design styles. Styling a form can be done manually by using the controls and shapes buttons on the left and bottom toolbars in Design View. Other Access form properties can also be modified by using the Property Sheet. This is opened by clicking on the Property Sheet button, which can be found under the Design tab when the form is in Design View. After making changes, close the Property Sheet and open the form in Form View to see the changes. In Base we can also edit some form properties through the Form Properties Window, similar to the Property Sheet in Access. To open this, click on the Form Properties button on the left toolbar in Form Design View. (If button is not clickable, activate it by first clicking on any existing control on the form).
Access Form Property Sheet Here are some of the modifiable properties of an Access form:
Base Form Properties Window
Modifiable properties for Base forms are not as comprehensive as in Access:
Modifying specific controls on a form (p. T8-5) In Access, specific controls can also be modified through the Property Sheet. The control to be modified can be selected from the dropdown menu in the Property Sheet header. Some properties can also be edited by right-clicking the control in the form and working through the right-click menu. The Control Properties Window in Base is opened by clicking on a control to select it, and then clicking the Control Properties button found on the toolbar above the Form Properties button. Access Property Sheet for a Text Box Some of the modifiable properties of a text box in Access:
Base Properties Window for a Text Box
Some styling properties such as font and background color can also be edited in Base, but again, the modifiable properties are not as comprehensive as in Access.
REPORTS Using the Report Wizard (p. T8-7) The report wizards of Access and Base are more similar than the form wizards, but still with slight differences. Access Report Wizard steps: • Field selection • If more than one table or query is used, wizard asks us to choose by which table we want our data to be grouped. If only one table or query is used, this step is skipped. • Grouping levels, where we can select by which fields we want data to be grouped. • Sort order, where we can specify how data in a specific field is sorted. • Layout: Columnar, Tabular, or Justified and Portrait or Landscape • Style, where we can choose from a variety of style templates
Naming of report
Base has only one way to create a report, which is through the wizard. Reports cannot be created using Design View. The Report Design View can only be opened with an existing report. Open the wizard by clicking on “Use Wizard to Create Report” in the main window. Base Report Wizard steps: • Field selection • Labeling fields, where we can change the name of a particular field as we want it to appear in the report • Grouping levels • Sort order • Choose layout: We can choose layout of data, layout or style of headers and footers, and page orientation. For layout of data and layout of headers and footers, we can select from a list of templates. Clicking on any from the list will change the layout of the report behind the wizard as a preview. • Naming of report As with the Form Wizard, the Report Wizard can’t add fields from two or more different tables or queries. A query would have to be created that combines the data from several tables, and then a report can be created based on this query. Modifying the Report Design (p. T8-8) As with forms, we can modify a report once it has been created. We can do this by opening the Report Design Views of both Access and Base. In Access’ Report Design View we can change the properties of the report and its various controls through the Property Sheet. We can also resize the columns or move controls around. AutoFormat can also be used to apply style templates to reports (Arrange tab > AutoFormat button). We can choose from the same styles provided for forms. In Base to open Design View, right-click on the report from the report list and select Edit. The report is opened with OpenOffice Writer (equivalent to Microsoft Word). For reports there is no Properties Window, but reports can be modified using Writer functions (changing fonts, modifying table properties, adding shapes, etc.) Changing Margins and Page Orientation for Reports (p. T8-9) To change a report’s page orientation in Access, open the report in Design View then click on the Page Setup tab on the menu bar. Clicking on the Page Setup button will open a dialog box, and here under the Page tab we can select Portrait or Landscape. We can also change the paper size in which the report will be printed. Changing a report’s margin sizes can be done under the Print Options tab in the same dialog box. In Base when the report is in Design View view, click on Format from the menu bar then select Page. In the dialog box that will appear, select the Page tab. Here we can change the page orientation of the report and change the margin sizes. 24
USING T8 FOR OPENOFFICE BASE Base can create the same useful forms and reports that Access can. The ways to create and modify forms and reports are completely different, however, and following the steps in T8 while using Base is impossible. One major difference of the two applications is Baseâ€™s lack of instant form and report creation. It is easier to use Access because it can create ready-to-use forms and reports with just a click of a button, while also giving us the flexibility to use the wizard or create from scratch using Design View. There are also big differences with regard to modifiable properties â€“ again, we have more flexibility with Access. Also, the graphic styles that Access has are more appealing than those of Base. However, the important thing is the usefulness of the forms and reports, and I believe we can rely on Base just as we can on Access.