AUTHOR'S MAIN SITE  »  TABLE OF CONTENTS for Open Office database tutorials.
-d- Bookmark this on Delicious   Recommend to StumbleUpon

Open Office ooBase (database) Tutorials

Two tables managed with one form

Including data entry

You may find that the database included in OpenOffice delights you as much as it has me. This page tries to help you use it.

Remember that Open Office, including ooBase, is free. Don't let that fool you, though. Big organizations, governmental and civilian, have adopted it as their standard office suite... and saving million$, but still Getting The Job Done. And making things easy for users on different platforms... Linux, Mac, Windows all spoken here!

There's more about ooBase in the main index to this material. Adabas? Star Office? Ancient history.

This page is "browser friendly". Make your browser window as wide as you want it. The text will flow nicely for you. It is easier to read in a narrow window. With most browsers, pressing plus, minus or zero while the control key (ctrl) is held down will change the texts size. (Enlarge, reduce, restore to default, respectively.) (This is fully explained, and there are more tips, at my Power Browsing page.)

Page contents © TK Boyd, Sheepdog Software, 12/10- 12/12

Two Tables. One Form.

It is rarely a Good Idea to work directly with a table. Not only is it a Bad Idea, but it is often less convenient than the correct answer: Work with a form, which is based on the table... or several tables. The following will give you an example of doing so.

The good news: You can download the database I am about to "talk" about. The bad news: I'm not going to do much explaining at this time. See if it is self explanatory? Download the database, which I've named FDB014

Someone asked at the excellent OpenOffice Database Forum ( how to manage two tables from a single form. As I had ten important things to do... all unappealing... I took up the challenge.

My scenario: I decided that the teachers at Hogwart's might want a way to record pupil misdemeanors.

The first table, Name, has a Name field (primary key... in my simple world, no two pupils have the same name) and a "House" field. (English schools tend to assign each pupil to a "house"... sometimes a real entity, often just an administrative fiction.) The "House" field is not used in the example... so far!

The second table, "Incident" has the following fields...

The sort of "incident" this system is designed to record is "running in the corridor", "shouting in the dining room", "pulling Hermione's pony tail", etc, etc.

Having set up the tables, I then established a relationship (not join) between Name.Name and Incident.Name

(There's more on relationships and joins in a short(er) page I've done talking about these important concepts in general terms. They are not the same thing, but the differences constantly blur in my mind, and I hope to help you fight that problem.)

Next, I used the wizard (ooBase wizard, not, alas, Rowling wizard) to create my form "EnterIncidents". It has a form with Name.Name and Name.House, and a subform with Incident.IncDescr. Both are displayed as datasheets.

===Scruffy notes on what I did in wizard begin.

Form wizard...

Main table: Name. All fields

Sub-form: Incident. Based on "Incident" relationship.

Put just IncDescr on subform

Display both as datagrids

===Scruffy notes on what I did in wizard end.

The names of pupils known to the system are displayed in the main form. New names can be added.

The form is used as follows...

First the user selects one of the names in the first datasheet, or adds a new name.

Once that is done, the second datasheet lists any incidents a teacher has accused that pupil of committing. And new incidents can be added, and as they are, the pupil's name is filled in on the resulting record in Incident.

If you try the form, and have the tables displayed while you do it, do not be alarmed if you don't see things you "have added" appearing in the displays of the underlying tables. If you save the record you've added via the form "EnterIncidents", and then hit the "refresh" button on either table, the display of what's in the table at the moment will be updated. It isn't updated automatically.

Hope that helps... it's all I have time for just now... Go "play" with the database, which you can just download.

Really, really cool: The provisions you can make with careful management of the two "cascade" options/properties on the link between Name.Name and Incident.Name.

If things are set up right, you can automatically purge the "Incident" table of all incidents concerning a given pupil simply by deleting the pupil's name... That will delete it from the Name table, and all of the incident records for that pupil... cool if that's what you want! You can also set things up so that a name can't be removed unless there are no records in the Incident table... a safer design, perhaps.

You can set things so that if you change, say, Fred to Freddie, then all of the incidents that Fred was charged with now relate them to Freddie.

Not only are these tricks of relational integrity tools fun, but they also protect the integrity (wonder where the name came from?) of the data in your tables. You can't enter an incident to a "Frde", for instance... not without first creating a "Frde", which you aren't likely to do.

Without the form, you would have to type each offender's name each time you put in a new incident record. With the form, that is taken care of for you.

Editorial Philosophy

I dislike 'fancy' websites with more concern for a flashy appearance than for good content. For a pretty picture, I can go to an art gallery. Of course, an attractive site WITH content deserves praise... as long as that pretty face doesn't cost download time. In any case....

I am trying to present this material in a format which makes it easy for you to USE it. There are two aspects to that: The way it is split up, and the way it is posted. See the main index to this material for more information about the way it is split up, and the way it is posted.

Ad from page's editor: Yes.. I do enjoy compiling these things for you... I hope they are helpful. However.. this doesn't pay my bills!!! If you find this stuff useful, (and you run an MS-DOS or Windows PC) please visit my freeware and shareware page, download something, and circulate it for me? Links on your page to this page would also be appreciated!

PLEASE >>> Click here to visit editor's Sheepdog Software (tm) freeware, shareware pages <<< PLEASE

If you liked this ooBase tutorial, see the main index for information other help from the same author.

Editor's email address. Suggestions welcomed!     - - -    Want a site hosted, or email? I like 1&1's services.

Valid HTML 4.01 Transitional Page tested for compliance with INDUSTRY (not MS-only) standards, using the free, publicly accessible validator at

One last bit of advice: Be sure you know all you need to about spyware.

. . . . . P a g e . . . E n d s . . . . .