Home > Sample chapters > Microsoft Office > Access

Create Databases and Simple Tables

In this chapter from Microsoft Access 2010 Step by Step, you’ll create a database from a template and create a table manually. Then you’ll adjust the display of a data table to fit your needs.

Chapter at a Glance

httpatomoreillycomsourcemspimages1744823.jpg

Creating the container for a database is easy. But an empty database is no more useful than an empty document or worksheet. It is only when you fill a database with data in tables (known as populating a database) that it starts to serve a purpose. As you add forms, queries, and reports, it becomes a useful tool. If you customize it by adding a startup page and organizing the various objects into categories and groups, it moves into the realm of being a database application.

Not every database has to be refined to the point that it can be classified as an application. Databases that only you or a few experienced database users will work with can remain fairly simple. But if you expect someone without database knowledge to enter data or generate their own reports, spending a little extra time in the beginning to create a solid foundation will save a lot of work later. Otherwise, you’ll find yourself continually repairing damaged files or walking people through seemingly easy tasks.

Microsoft Access 2010 takes a lot of the difficult and mundane work out of creating and customizing a database by providing database applications in the form of templates that you modify and populate with your own information. Access 2010 also provides templates for common elements that you might want to plug into a database. These application parts consist of sets of objects—a table and related forms, queries, or reports—that together provide a complete, functioning part of a database. All you have to do is fill in your data. If none of the templates meet your needs, you can create tables manually.

In this chapter, you’ll create a database from a template and create a table manually. Then you’ll adjust the display of a data table to fit your needs. By the end of this chapter, you’ll have a database containing a few tables and you’ll understand a bit about how the tables in the databases you will use for the exercises in the remaining chapters of the book were created.

Creating Databases from Templates

A few years ago (the distant past, in computer time), creating a database structure involved first analyzing your needs and then laying out the database design on paper. You would decide what information you needed to track and how to store it in the database. Creating the database structure could be a lot of work, and after you created it and entered data, making changes could be difficult. Templates have changed this process, and committing yourself to a particular database structure is no longer the big decision it once was.

A template is a pattern that you use to create a specific type of database. Access 2010 comes with templates for several databases typically used in business and education, and when you are connected to the Internet, many more are available from the Microsoft Office Online Web site at office.microsoft.com. By using pre-packaged templates, you can create a database application in far less time than it used to take to sketch the design on paper, because someone has already done the design work for you.

Using an Access template might not produce exactly the database application you want, but it can quickly create something that you can customize to fit your needs. However, you can customize a database only if you know how to manipulate its basic building blocks: tables, forms, queries, and reports. Due to the complexity of these templates, you probably shouldn’t try to modify them until you’re comfortable working with database objects in Design view and Layout view. By the time you finish this book, you will know enough to be able to confidently work with the sophisticated pre-packaged application templates that come with Access.

In this exercise, you’ll create a database application based on the Tasks template. This template is typical of those provided with Microsoft Access 2010, in that it looks nice and demonstrates a lot of the neat things you can do in a database.

  1. In the Available Templates area, click Sample Templates.

    Access displays a list of the templates that shipped with the program and are installed on your computer.

  2. Click the Tasks template icon.

    In the right pane, you can assign a name to the database and browse to the location where you want to store the database.

    httpatomoreillycomsourcemspimages1744825.jpg

    The Tasks template is supplied with Access.

  3. In the File Name box, type MyTasks.

  4. Click the adjacent Browse button, and then in the File New Database dialog box, navigate to your Chapter02 practice file folder.

    httpatomoreillycomsourcemspimages1744827.jpg

    You use the same navigational techniques in this dialog box that you would use in any Open or Save dialog box.

    httpatomoreillycomsourcemspimages1744829.jpg

    The File New Database dialog box.

  5. With Microsoft Access 2007 Databases selected in the Save as type box, click OK.

    The path to the specified folder is displayed below the File Name box.

  6. Click the Create button.

    Access briefly displays a progress bar, and then the new database opens, with the Task List form displayed in Layout view.

  7. If the Navigation pane is closed, click the Shutter Bar Open button at the right end of its title bar to open it. Then if any of the groups are collapsed, click their chevrons to open them.

    httpatomoreillycomsourcemspimages1744747.jpg

    The Navigation pane displays a custom Tasks Navigation category.

    httpatomoreillycomsourcemspimages1744831.jpg

    The custom category has custom Tasks, Contacts, and Supporting Objects groups.

  8. In the Navigation pane, click the Tasks Navigation title bar, and then in the category and group list, click Object Type to list all the objects in this database.

  9. In the Tables group, double-click Contacts.

    The empty Contacts table is displayed. You could now start entering data in this table.

  10. Right-click the Contacts tab, and click Close All.

  11. On the Create tab of the ribbon, in the Templates group, click the Application Parts button.

    httpatomoreillycomsourcemspimages1744833.jpg

    The Application Parts gallery appears.

    httpatomoreillycomsourcemspimages1744835.jpg

    The Application Parts gallery.

    You can add various types of forms and several sets of related tables and other database objects to this or any other database. These ready-made objects give you a jump start on creating a fully functional database application.

  12. Click away from the gallery to close it.

  13. Continue exploring the objects that are part of the MyTasks database on your own.