microsoft® access 2007:...

33
Microsoft® Access 2007: introduction Even if you have no experience with databases, Microsoft Access 2007 lets you create a user-friendly database for storing business or personal records, such as addresses, product data and business transactions. In this tutorial, you'll learn how to use Microsoft Access and become familiar with the Access 2007 interface, as well as create a simple database that includes tables, queries and forms. Lessons What is Microsoft Access used for? 1. Microsoft Access 2007 is one of the easiest databases to use, thanks to the tabbed command system. In this lesson, you'll tour the Access 2007 interface, learn where commands are located and understand the purpose of database objects, tables, forms and queries. Microsoft Access how to: work with database tables 2. To build a useful, accurate database, you need to use tables. This lesson begins by showing you how to create a new database. Then you'll explore tables, learning how to use table relationships to connect information within a database. Microsoft Access how to: create and use queries 3. In this lesson, you'll learn how to construct queries in Access 2007 that sort and filter data. You'll use queries to join two or more tables, and even add, change or delete data in multiple records at once. Microsoft Access how to: work with forms 4. When you use a database, you want it to be as simple as possible to enter, edit or display data. Forms are the best way to achieve simplicity in an Access 2007 database. This lesson shows you how to create, modify and use forms. What is Microsoft Access used for? Microsoft Access 2007 is one of the easiest databases to use, thanks to the tabbed command system. In this lesson, you'll tour the Access 2007 interface, learn where commands are located and understand the purpose of database objects, tables, forms and queries. Welcome to the class Microsoft Access 2007 is a full-featured database application which you can use to manage, track and share information from multiple sources. Even if you have no experience with databases, Access 2007 lets you easily create a user- friendly database for storing business or personal records, such as addresses, product data and business transactions. In this Microsoft Access tutorial for beginners, you'll become familiar with the Access 2007 interface, learn about basic database design and create a simple but complete database that includes tables, queries and forms. This class is geared toward employees in small to medium-size businesses who are new to databases and Access 2007 software. However, personal users can also benefit from the class by learning the fundamentals of Access 2007. There are four lessons in this class, described as follows: Lesson 1 explores the Access 2007 interface, shows you where commands are located and explains the purpose of database objects, tables, forms and » Microsoft Access

Upload: others

Post on 23-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Microsoft® Access 2007: introductionEven if you have no experience with databases, Microsoft Access 2007 lets you create a user-friendlydatabase for storing business or personal records, such as addresses, product data and businesstransactions. In this tutorial, you'll learn how to use Microsoft Access and become familiar with theAccess 2007 interface, as well as create a simple database that includes tables, queries and forms.

LessonsWhat is Microsoft Access used for?1.Microsoft Access 2007 is one of the easiest databases to use, thanks to thetabbed command system. In this lesson, you'll tour the Access 2007 interface,learn where commands are located and understand the purpose of databaseobjects, tables, forms and queries.

Microsoft Access how to: work with database tables2.To build a useful, accurate database, you need to use tables. This lessonbegins by showing you how to create a new database. Then you'll exploretables, learning how to use table relationships to connect information within adatabase.

Microsoft Access how to: create and use queries3.In this lesson, you'll learn how to construct queries in Access 2007 that sort andfilter data. You'll use queries to join two or more tables, and even add, changeor delete data in multiple records at once.

Microsoft Access how to: work with forms4.When you use a database, you want it to be as simple as possible to enter, editor display data. Forms are the best way to achieve simplicity in an Access 2007database. This lesson shows you how to create, modify and use forms.

What is Microsoft Access used for?Microsoft Access 2007 is one of the easiest databases to use, thanks to the tabbed command system. In thislesson, you'll tour the Access 2007 interface, learn where commands are located and understand the purposeof database objects, tables, forms and queries.

 

Welcome to the class

Microsoft Access 2007 is a full-featured database application which you canuse to manage, track and share information from multiple sources. Even if youhave no experience with databases, Access 2007 lets you easily create a user-friendly database for storing business or personal records, such as addresses,product data and business transactions.

In this Microsoft Access tutorial for beginners, you'll become familiar with theAccess 2007 interface, learn about basic database design and create a simplebut complete database that includes tables, queries and forms.

This class is geared toward employees in small to medium-size businesseswho are new to databases and Access 2007 software. However, personalusers can also benefit from the class by learning the fundamentals ofAccess 2007.

There are four lessons in this class, described as follows:

Lesson 1 explores the Access 2007 interface, shows you where commandsare located and explains the purpose of database objects, tables, forms and

»  Microsoft Access

Page 2: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

queries.Lesson 2 shows you how to create a new database, and examines howtables and table relationships can help you connect information within adatabase.Lesson 3 explains how to construct queries that sort and filter data. You'llalso learn how to join two or more tables, and add, change or delete data inmultiple records at once.Lesson 4 focuses on how forms are used in Access 2007. You'll discoverhow to create, modify and use forms for simple entering, editing or display ofdata.

As you work through the lessons, you'll see references to an Accesssample database called Northwind 2007. This sample database isespecially useful for users new to Access; you can use it to see howvarious functions and features work before you create them on your own.

Beyond the lessons, be sure to complete the assignments and quizzes.They're designed to reinforce important topics covered in the lessons andenable you to practice some new skills.

Throughout this class, we provide Flash examples. To view theseexamples, you need the Adobe Flash Player. Keep an eye out for noteswith links that say "See how to ____" or something similar. Some of thesefiles are very large (10 MB or so) and may take a while to appear ordownload if you have a slow connection.

Let's get started with the topics in Lesson 1.

 

Getting started with Access 2007

Most of us use databases all the time and just don't realize it. Online maps, forexample, are created from databases. The list of contacts in Microsoft Outlook2007 is a database, too. Generally, when you want to find something orsomeone by conducting a search on your computer or the internet, a databaseis also in play. Salespeople use databases to manage leads, teachers andstudents use them to track assignments, public relations teams use them tohandle events—the list goes on.

Access 2007 is Microsoft's most recent version of its popular database product.With it, you can track information, create reports and share information withothers. A variety of changes have been made to the interface to make it moreintuitive and simpler to use. One of the most important changes is in the look ofAccess. Instead of the toolbars and menus found in previous versions, a baracross the top of the Access window is displayed that holds the commands youneed to create and use your database. This bar is called the Ribbon.

The Access Ribbon

The Ribbon is a tab system that holds the commands you need when workingwithin Access, as shown in Figure 1-1. Here are the things to remember aboutthe Ribbon:

It's intuitive—it responds to the actions you take, so you only see thecommands necessary for the activity you're performing. As you carry outdifferent tasks, you see new options appear in the Ribbon.Each tab is called a command tab.As you work on specific tasks or objects, the command tab you're workingwith is called a contextual command tab. The contextual command tabholds the specific commands that pertain to the actual activity you'reconducting in Access. At any given time, any tab can become a contextual

»  Desktop & all-in-onePCs

»  HP Business desktopPCs

Page 3: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

command tab—it just depends on what you're working on in your database.

Figure 1-1: Commands are located within tabs in the Ribbon.

Enlarge image

In Figure 1-1, the Home tab is selected and is therefore the current contextualcommand tab. As you look closely, you'll see there are seven groups within theHome tab: Views, Clipboard, Font, Rich Text, Records, Sort & Filter and Find.Each of these groups is called a command group because a variety ofcommands are contained within each group.

The commands shown in each group when you first select a tab are the mostcommonly used commands for that group. Some command groups, however,have a small, angled arrow located in the lower-right corner. Click the arrow toopen a dialog box that provides additional commands to choose from.

Every tab on the Ribbon holds a variety of commands related to the groupname. In Figure 1-1, for example, take a look at the Font group. As you cansee, it holds commands that let you change aspects of the font in yourdatabase—you can change the font color, size, type and so on. To cut andpaste information in your database, however, you would move left on theRibbon to the Clipboard group—that's the group that holds items related tocutting, copying and pasting.

You should become familiar with the Ribbon tabs before you create adatabase—at a minimum, click each tab to see which groups it contains. As youuse the Ribbon more and more, it'll become obvious which commands arelocated in the various tabs and groups.

See how to use the Access 2007 Ribbon.

In the next section, you'll take a look at another new feature in Access 2007:the Microsoft Office Button.

 

Becoming familiar with the Microsoft Office button

In the upper-left corner of the Access window is a fairly large circle with fourdifferent colored squares. This is the Microsoft Office Button, as shown inFigure 1-2. It replaces the File menu used in previous versions of Access, andit holds commands you'll use often, such as Save, Print and Open.

Figure 1-2: The Microsoft Office Button.

When you click the button, the Office menu appears. When you select acommand in the left pane, such as Save As, a second menu appears in theright pane as shown in Figure 1-3. Just click a command in the right pane asneeded.

»  HP Everydaycomputing laptop PCs

»  HP Balanced mobilitylaptop PCs

Page 4: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 1-3: The Microsoft Office Button menu and Save As submenu.

Notice the Access Options button in the lower-right corner of the Office menu.You can click this button to find a variety of customizable options, such asdefault colors or fonts for your databases, proofing and spell-check features,security features and more.

When you're ready to close Access, just click the Exit Access button locatednext to the Access Options button. Careful, though—clicking this buttonautomatically exits the entire program so be sure you've saved your databaseappropriately before exiting.

Next, let's take a look at the Navigation Pane.

 

Using the navigation pane

The Navigation Pane is a brand-new feature in Access 2007. It's locateddirectly below the Ribbon on the left side of the Access window, as shown inFigure 1-4. Unless you collapse it, it'll be visible at all times. That's a goodthing—the Navigation Pane shows you every object in your database so thatyou can easily find the item you need to work on.

»  HP iPAQ handhelds

»  HP Handhelds

Page 5: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 1-4: The Navigation Pane.

Objects are placed by default into specific categories and then divided intoAccess groups indicated by icons to the left of the object title. Figure 1-4 showshow the Employee category has been divided into different Access groups,such as reports, invoices, forms and so on.

To open a specific category, click the double down arrows to the right of thecategory name. Once a category has been opened, the double arrowsreverse—just click them again to collapse a category.

If an item is based on more than one table, you'll see it in multiple categories.

To see a specific item within a category, double-click it. The item opens as atab in the large pane to the right. For example, double-clicking the SalesAnalysis item in the Tables list on the left opens the Sales Analysis table in theright pane, as shown in Figure 1-5.

Page 6: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 1-5: Sales Analysis views.

Enlarge image

When you're ready to close a tab, just click the Close button (X) to the far rightof the tab.

See how to use the Navigation Pane.

In the next section, you'll explore databases in a bit more detail.

 

What is a database?

Now that you have an idea of how Access 2007 is set up, let's explore theconcept of databases in more detail. The simplest way to think of a database isto think of it as a collection of information pieces that are stored in a logical,structured format on a computer. Each piece of information is stored as arecord, which can be quickly accessed and used.

Database objects

In a database, an object identifies how and where pieces of information arestored. In Access 2007, a database object can be saved in multiple ways andcould be a:

TableColumnReportFormMacroViewModule

In this class, you'll focus on objects that are tables or forms.

Tables

Tables are made of rows and columns, just as they are in any other Officeprogram. The similarity stops there, however. In Access tables, every row andcolumn is stored as a separate piece.

Rows are called records in Access. Each record can then have multiplecolumns, which are called fields. The Employees table shown in Figure 1-6, forexample, has separate employee records (rows) that contain various fields(columns) containing the individual employee's first and last names, emailaddress, job title, phone numbers, address, and so on.

»  HP Performance laptopPCs

»  HP Performance andentertainment laptopPCs

Page 7: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 1-6: Employees table with records and fields.

Enlarge image

Forms

You don't need to include forms in a database; however, they can make itmuch easier to enter data and perform different commands, such as entering,viewing and editing information. You can also create forms that show specificfields or allow users to perform only certain actions. A sample form is shown inFigure 1-7.

Figure 1-7: A sample form.

You can also add command buttons to forms, and easily program them so thata single click launches an action in the database.

Queries

We haven't mentioned queries yet, but you'll be hearing a lot more about themas this class progresses. The query feature enables you to take informationfrom all the tables you create and drop them into a single datasheet where youcan see all the information at a glance. It's basically a question and answerprocess—you ask Access a question, and Access responds with the answer. If,for example, you want to know how much of a specific product is in yourinventory, you can run a query that displays the information.

Queries can filter data, perform calculations and summarize data very quickly.

There are two types of queries:

Select query: Retrieves specific data that you ask forAction query: Retrieves data you specifically ask for and performs a task atthe same time, such as inserting, updating or deleting records

Well-designed databases can use queries to get information from multipletables at once, which gives you a very simple way to access and consolidateinformation.

Moving forward

You've learned a lot about Access 2007 in this lesson; from the Ribbon to thetypes of objects you can use in a database. In Lesson 2, you'll discover moreabout how to create a new database and work with tables in depth. Before youmove on, however, don't forget to take the quiz and complete the assignment.

Page 8: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Assignment #1

For this assignment, you'll practice using the Ribbon to find Microsoft Access 2007 commandsyou'll use most often. Open the Northwind 2007 sample database in Access 2007 by followingthese steps:

Open Access 2007.1.Click Local Templates under Template Categories.2.Click Northwind 2007 under Local Templates (in the center of your screen).3.Click Create in the right pane. Be patient; it might take a few moments to load.4.

If a security warning appears on the Startup Screen for the database, follow these steps:

Click Options.1.Select Enable this content.2.Click OK.3.In the Login Dialog dialog box that appears, click Login. It doesn't matter which employee4.you select.

Follow these steps to practice working with the Ribbon:

On the Home tab, click the down arrow under View in the Views group.1.Select Design View. Click the View down arrow again and select Layout View. Toggle2.between these views to explore how the interface changes in one view versus another.Using the same process, return to Form view. Highlight New under the Active Orders3.Status column. Change the font color and size using the options in the Font group on theHome tab. Notice how Access changes all text; not just the highlighted word.Click the Create tab.4.Click Table in the Tables group.5.Enter text, such as Sample Field, into the field where your cursor has been placed.6.Press Tab.7.Click the Database Tools tab.8.Click Relationships in the Show/Hide group. Scroll through the extensive list of9.relationships between the tables in the Northwind 2007 database.Click the red Close button on the toolbar.10.Click No when prompted to save changes.11.Click the Microsoft Office Button.12.Click Close Database.13.Click No if prompted to save changes.14.Exit Access 2007.15.

 

Quiz #1Question 1:True or False: A database lets you track information, create reports and share information with others.

A) True

B) False

 

Question 2:What's the Ribbon?

A) A tab system that holds the commands you need when working within Access 2007

B) A group of commands on an individual tab

C) The navigation bar along the left side of the Access 2007 window

D) Another name for the status bar at the bottom of the Access 2007 window

 

Question 3:Which of the following commands can you access using the Microsoft Office Button? (Check all thatapply.)

A) Save

Page 9: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

B) Print

C) Delete

D) Open

 

Question 4:True or False: The Navigation Pane shows every object in your database.

A) True

B) False

 

Question 5:True or False: A database object identifies how and where pieces of information are stored.

A) True

B) False

 

Microsoft Access how to: work with database tablesTo build a useful, accurate database, you need to use tables. This lesson begins by showing you how to createa new database. Then you'll explore tables, learning how to use table relationships to connect information withina database.

 

Creating a new blank database

Welcome back. In Lesson 1, you became familiar with the Microsoft Access2007 interface. You also learned about the components that make up adatabase, such as tables, forms, reports and more. In this lesson, you'll begincreating your own database and the tables within that database. Along the wayyou'll explore relationships between tables, which let you maintain uniqueinformation in separate tables yet tie them together with a common field, mainlyfor querying and reporting purposes.

You can create databases in many different ways. One of the easiest methodsis to use a template provided by Microsoft. When you first open Access 2007,the Getting Started with Microsoft Office Access screen appears. Just selectone of the featured templates in the middle of the screen or click a templatecategory in the left pane. Some templates are stored on your computer (localtemplates), whereas others are available for download from Microsoft OfficeOnline.

Templates are ideal for creating many different kinds of database projects,especially if you want a ready-made solution that requires minimalcustomization. However, if you need a custom database with unique tables andforms, you should start with a blank database.

To create a new blank database:

Open Access 2007. If Access is already open, click the Microsoft1.Office Button and then click New.In the Getting Started with Microsoft Office Access screen, click Blank2.Database under New Blank Database.In the right pane, under File Name, type the name you want for your3.new database.Click Create in the right pane, as shown in Figure 2-1.4.

»  Slim and sleek desktopPCs

»  HP Thin clients

Page 10: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 2-1: Creating a new blank database.

Enlarge image

The blank database appears with an empty table called Table1. Your cursor isautomatically placed in the Add New Field column, as shown in Figure 2-2. Atthis point, you need to enter column names for each field in your database, andthen save the database with the new structure. You'll learn how to do thesetasks on the next lesson page.

Figure 2-2: Add New Field column.

Changing views

Want to change views in Access 2007? You can click the down arrow underthe View button in the Views group Home tab. Another method is to use one ofthe Views buttons in the lower-right corner of the database window. Just clickthe button for the view you want, and Access instantly changes views.

See how to change views in Access 2007.

Let's take an in-depth look at tables.

 

Database tables in depth

As discussed previously, tables are comprised of records and fields. Inaddition, every table should have a primary key—a field used to identifyindividual records stored in a table. This is usually an ID number or a productcode, as shown in Figure 2-3. Each record must have a unique entry in theprimary key that doesn't change to enable other tables to find and sync to it.

»  Microsoft Access

Page 11: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 2-3: A primary key example; Datasheet view is on top, Design view onthe bottom.

To be as useful as possible, create each table to focus on a major subject andresist the urge to include all possible information in one table. In a database,you can create relationships between tables (covered in the next section),which makes it easier to keep track of all your information.

For example, if the major subject is "Employees" and you also want to trackhow many vacation days an employee takes in a year, create a second tablecalled "Vacation." In the Employees table, include general employeeinformation such as employee ID, name, address, phone, emergency contactand so on. In the Vacation table, include an Employee ID field (the primary keyfield) in addition to supporting information, such as number of vacation daysaccrued and number used.

When you create a relationship between the two tables using the Employee IDfield, you'll be able to see all the information at a glance when you want to. Bykeeping the information in separate tables, you reduce the risk of enteringduplicate information and can retrieve information more quickly.

The goal of good database design is to be able to update information inonly one place in the database. In addition, you need to prevent duplicateentries and avoid entries for the same field that contain contradictory data.By keeping unique information in separate tables and "linking" them by acommon field—the primary key—you accomplish this goal.

In addition, as you build a table, refine the fields as much as possible. Separateemployee names into first and last name fields, for example. This approachmakes it much easier to search, sort and index your database.

Before you begin actually creating a table, let's take a minute to examine tablerelationships.

 

Understanding table relationships

It's important to understand table relationships in Access 2007 so you can buildtables accurately for easy retrieval of information. When you query Access for

Creating a trustedlocation

Page 12: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

information or print reports, table relationships are the core of how Access findsthe right information to respond with.

Table relationships are built by providing common fields among differenttables in Access—as Access recognizes those common fields, it links tablestogether.

Let's open the sample Northwind Traders database in Access 2007, which youworked with in the Lesson 1 assignment. As a reminder:

In Access 2007, click the Microsoft Office Button and then click New.1.In the Getting Started with Microsoft Office Access screen, click Local2.Templates in the left pane.Click Northwind 2007 under Local Templates in the center of the3.screen.Click Create in the right pane.4.

If a security warning appears on the Startup Screen for the database, clickOptions, select Enable this content, click OK and then click Login. It doesn'tmatter which employee is selected.

With the sample database open, click the double right arrows in the left pane todisplay the Navigation Pane. Next to Northwind Traders, click the down arrowand select Tables and Related Views.

To see an example of table relationships, follow these steps:

Click Customers.1.Click Customers: Table.2.Click the Database Tools tab.3.In the Show/Hide group, click Relationships.4.

The table relationships Access has built for this sample database aredisplayed, a portion of which are shown in Figure 2-4.

Figure 2-4: Table relationships.

As you review this figure, notice that each a table relationship is represented bya line drawn between the tables. Also notice that in each table, a small goldkey accompanies the first field. This is the primary key, and every table shouldhave one.

There's a lot to know about table relationships; however, in this class you'lllearn about three main types of table relationships: one-to-many, many-to-many and one-to-one.

One-to-many

In a one-to-many table relationship, one side of the relationship has many

You can bypass Accesssecurity warnings uponopening databases bymaking the folder in whichyou store databases a trustedlocation. Click the MicrosoftOffice Button and then clickthe Access Options buttonat the bottom of the menu. Inthe left panel, click TrustCenter. Click the TrustCenter Settings button onthe right. Click TrustedLocations in the left panel,and then click the Add newlocation button. In theMicrosoft Office TrustedLocation dialog box, clickBrowse, locate the folder inwhich you store yourdatabases, click OK, checkthe Subfolders of thislocation are also trustedcheck box, and then click OKagain. Click OK as manytimes as needed to close anyopen dialog boxes orwindows.

»  HP TouchSmartdesktop PCs

»  HP Business desktopPCs

Page 13: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

items while the other side has just one. Here's an example: A customer canpurchase many different products from a company. The company's databaseshould include a Customers table and a Products table. When you form arelationship between these tables, you're creating a one-to-many relationship.

Creating a one-to-many relationship can be done by using the customer'sprimary key and adding it as an additional field on the "many" side of therelationship.

Many-to-many

Now let's say you have multiple customers ordering multiple products. In thisscenario, you would still have your Products table, plus you would have anOrders table to keep track of orders. Because there can be multiple orders forany product as well as multiple products on any given order, you can create a"many-to-many" relationship to help you manage both sides of the relationship.

When you create a many-to-many relationship, a third table called a junctiontable is used to break down the many-to-many relationships into two one-to-many relationships. The primary key from each table (Products and Orders) isinserted into the junction table so Access can track everything.

One-to-one

In this type of relationship, each side of the relationship has just one matchingrecord between them. This is an unusual relationship and you'll rarely see it asyou use Access.

One example of a one-to-one relationship occurs in warehouse management.Say you have XYZ widget, stored in XYZ bin. There is only one kind of widgetin the bin, and there is only one bin containing the widget. This is a one-to-onerelationship between widget and bin. In the next section, you'll learn how tocreate a table as well as how to create a table relationship.

 

Creating a table

You can create tables in different ways; however, the most common method isto create a new blank table in a database. To do that, open an Accessdatabase (such as the Northwind 2007 database) and follow these steps:

Click the Create tab.1.Click Table in the Tables group. A new table appears with the cursor in2.the Add New Field box, as shown in Figure 2-5.

Figure 2-5: A new table.

To enter a new field name, just begin typing. For example, type Field 1.1.Press Tab on your keyboard to create and move to the next field;Access automatically adds a new field (or column) for you as well. You

»  HP Everydaycomputing laptop PCs

»  HP Balanced mobilitylaptop PCs

Page 14: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

can continue adding as many fields as you need.When you're finished, right-click the Table1 tab and select Save from2.the shortcut menu. In the Save As dialog box, enter a name for yourtable and click OK.

To rename a table, right-click the table in the Navigation Pane, click Renameand then enter a new name.

See how to create a table, enter field names and save the table.

Now we'll take a moment to look at the Data Type field. Right-click the table'stab and select Design View. The Data Type field indicates the type of datastored in a particular data field. You can select from a wide variety of datatypes: Text, Memo, Number, Date/Time, Currency, AutoNumber, Yes/No, OLEObject, Hyperlink, Attachment and Lookup. Figure 2-6 shows the Data Typedrop-down list in Design View.

Figure 2-6: Data types.

It's important to select the correct data type when creating fields becausechanging a data type after records have been entered into a table canresult in data loss.

Setting a primary key

As mentioned previously, primary keys are critical to table relationships.Access sets a primary key by default in the first field of your table, and uses atechnique called autonumbering to automatically assign a unique value to eachrecord. However, you can change the field name or the data type of a primarykey field, or even assign the primary key to a different field.

Here's how to create a new primary key field:

Open the table in Design View by right-clicking the table in the1.Navigation Pane and selecting Design View.Select the first blank row in the design grid.2.Type a name for the field.3.Click in the Data Type field and select AutoNumber from the drop-down4.list.Click the Design tab.5.Click Primary Key in the Tools group.6.

When you're working in a table, the key is called the primary key. When you'reworking in a different table, the key is referred to as a foreign key. It looks

Page 15: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

exactly the same; the name depends on which table you're working in.

A primary key can consist of the AutoNumber data type, in addition to Number,Memo, Dates/Time, Currency and so on. The more specific you are whensetting primary keys, the more accurate your table relationships, reports andqueries will become.

Next, learn how to create a relationship between tables.

 

Creating a table relationship

Once you create several tables and set primary keys, you can createrelationships between the tables. For now, let's use the Northwind 2007database to demonstrate how to create a sample table relationship:

Click the Database Tools tab.1.Click Relationships in the Show/Hide group.2.Click Show Table in the Relationships group. The Show Table dialog3.box appears, as shown in Figure 2-7.

Figure 2-7: Show Table dialog box.

Click the table of your choice (for example, Purchase Order Status)1.and then click Add.Click Close.2.Go to the new table (Purchase Order Status_1) that appears in the3.Relationships window. You can drag the right edge of the new table tothe right to view the entire table name, if necessary.Click and drag the primary key (Status ID) from Purchase Order4.Status_1 to the foreign key of the Order Details Status table, which islocated above and to the right of Purchase Order Status_1. The EditRelationships dialog box appears, as shown in Figure 2-8.

»  HP iPAQ handhelds

»  HP Handhelds

Page 16: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 2-8: Edit Relationships dialog box.

Click Create.1.

Take a look at your Relationships window now. The Purchase Orders Status_1table is now linked directly the Order Details Status table by a thick black line,as shown in Figure 2-9.

Figure 2-9: Newly created table relationship.

See how to create a relationship between tables.

If you need to remove a relationship between tables, click the black line andpress Delete. You can create, delete and re-create table relationships asneeded.

See how to remove a relationship between tables.

Once you've set up your tables, you're ready to begin entering data. That'scovered next.

 

Entering and editing data

To enter data into a table, open the table in Datasheet view. Click in the firstblank field and enter your text, pressing Tab or Enter to move to the next field.When you reach the last field and press Tab or Enter, Access creates a newblank record below it.

Page 17: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

You don't need to continually save your data as you add data to new records.Access commits the changes to a table as the cursor moves to a new field inthe same record or when the cursor moves to a new record.

The way you enter data into a field depends on the data type associated withthat field. For example, a field called LastName most likely has a Text datatype, whereas an OrderDate field would ordinarily have a Date/Time data type.The kind of data you're allowed to enter into these fields is different. Data typesare designed to restrict the type of data you can enter into a field to simplifydata entry and reduce errors. If you enter data incorrectly, a warning messagedisplays to inform you that the value you entered isn't valid.

If you need to change any data in a record, select the text within a field. Usethe arrow keys to position the insertion point as needed. Then use theBackspace or Delete key on the keyboard to remove text and enter new textto replace it. You can also select all text within a field and enter replacementtext—in this case all text is replaced.

Moving forward

You've covered a lot of ground in this lesson; tables and table relationships areimportant to understand as you work in Access 2007. Take the time to practicein the Northwind 2007 database until you become comfortable with creatingand working with tables and relationships. In Lesson 3, you'll dive into queries.You'll learn how to join two or more tables with queries, and then add, changeand delete data in multiple records at once. Before you move on, however,don't forget to take the quiz and complete the assignment for this lesson.

»  HP Performance laptopPCs

»  HP Performance andentertainment laptopPCs

Assignment #2

For this assignment, you'll create a database that tracks your favorite movies.

Follow these steps:

Create a database called MyMovies.1.Create two tables in the database in Design view. The Movies and Genre tables should2.contain the following fields:

Try creating the tables in Design view. After selecting Create > Table, right-click the table's taband select Design View.

Table Fields Data Type

Movies MovieID (primary key)

Title

GenreID

YearReleased

Actors

MyRating

AutoNumber

Text

Number

Text

Text

Text

Page 18: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Genre GenreID (primarykey)

MovieGenre

Number

Text

In Datasheet view, add five movies of your choice to the Movies table, populating the Title,1.YearReleased, Actors and MyRating fields.

In the each Actors field, enter two actors who appeared in each movie, separating the text withcommas. The MyRatings field should contain E (for excellent), G (for good) or P (for poor). Besure to assign a rating of E to at least two movies.

In the Genre table, enter the following values.1.

GenreID MovieGenre

1 Action

2 Romance

3 Comedy

4 Children's

5 Thriller

6 Other

Close both tables but leave the database open.1.Click the Database Tools tab.2.Click Relationships in the Show/Hide group.3.In the Show Table dialog box, select each table and click Add. (If the Show Table dialog4.box doesn't appear automatically, click Show Table in the Relationships group on theRibbon.)Click Close.5.Click and drag the primary key (GenreID) from the Genre table to the GenreID of the6.Movies table.In the Edit Relationships dialog box, click Create.7.Save your changes, close the database and exit Access 2007.8.

 

Quiz #2Question 1:True or False: Tables are comprised of records and fields.

A) True

B) False

 

Question 2:Which of the following are types of table relationships? (Check all that apply.)

A) One-to-many

B) Many-to-many

Page 19: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

C) Two-to-one

D) One-to-one

 

Question 3:True or False: Every table should have a primary key.

A) True

B) False

 

Question 4:True or False: You can view table relationships by clicking Relationships in the Show/Hide group of theExternal Data tab.

A) True

B) False

 

Question 5:True or False: When you enter data into a table, you can move to the next field or record using the Tabor Enter key.

A) True

B) False

 

Microsoft Access how to: create and use queriesIn this lesson, you'll learn how to construct queries in Access 2007 that sort and filter data. You'll use queries tojoin two or more tables, and even add, change or delete data in multiple records at once.

 

Understanding queries

Welcome back. In Lesson 2, you created a database, a table and learnedabout relationships between tables. In this lesson you'll explore queries.

There are many reasons that databases have an advantage overspreadsheets. One of those is the capability a database has to run complexqueries—requests for data results or specific actions based on certain data.Some queries can even accomplish both things at once.

Depending upon what you ask, a query can filter data, perform calculations,summarize data for you or even automate different data management tasks. Awell-designed database can use a query to obtain data from multiple tables;that's one reason it's so important to carefully define table relationships asdiscussed in Lesson 2.

If a query uses two or more tables, the tables must be joined by a relationship.

Queries use criteria, which are conditions specific for a particular field. Forexample, "Show only those records where the value of a city is Portland" is avalid criteria for a query. If you need to further break down the results (perhapsyou have customers in Portland, Maine and Portland, Oregon), you can addadditional criteria to help refine the results, such as adding an address, a Zipcode or a state.

You can do a lot of different things with queries, even make calculations usinginformation that isn't stored within your database tables. For instance, yourdatabase might not specifically list a person's actual age; however, if you knowthe current date and the person's date of birth, you can create a query thatcalculates and continually updates a person's age for you.

Next, learn how to create a select query using the Microsoft Access 2007

»  Slim and sleek desktopPCs

»  HP Thin clients

Page 20: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Query Wizard.

 

Creating a select query with the Query Wizard

A really useful tool in Access 2007 is the Query Wizard. If you're not thatfamiliar with queries, or even with databases in general, this easy-to-usewizard can be a big help. It walks you through the steps of creating a query,and is pretty close to foolproof.

There are different types of queries you can run in Access 2007. With a selectquery, you can select and create specific subsets of data to answer questions,and then use that query to provide data to other objects in your database. In aselect query, you can ask for data from a single table or multiple tables.

Follow these steps to create a select query using the Query Wizard:

Click the Create tab on the Ribbon, and then click Query Wizard in the1.Other group.In the wizard, click Simple Query Wizard as shown in Figure 3-1. Click2.OK.

Figure 3-1: Simple Query Wizard.

Select fields for your query in the next screen. First select a table or1.query from the Tables/Queries drop-down list, and then select the fieldsyou want to use in your query from the Available Fields list. Use thehorizontal single arrow to add these fields into the Selected Fields list,as shown in Figure 3-2.

If you click the double horizontal arrows, Access automatically places allavailable fields into the Selected Fields list.

»  Desktop & all-in-onePCs

»  HP Business desktopPCs

Page 21: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 3-2: Selecting fields.

To select a field from another table or query, select it in the1.Tables/Queries list and add the desired field or fields to the SelectedFields list. Click Next.If you're prompted to select a detail or summary query, select Detail to2.display every field of every record or Summary to display just asummary of information. Click Next.Enter a title for your query in the text box at the top of the screen, as3.shown in Figure 3-3. You can modify the query before completing thewizard by selecting the Modify the query design option, or just leavethe Open the query to view information option selected. Click Finish.

When naming queries, forms and reports in Access, some users consider itgood practice to begin query names with "qry," form names with "frm" andreport names with "rpt." However, Access 2007 is highly flexible, enabling youto name these objects in whatever way suits your needs.

Figure 3-3: Naming the query.

The query appears as a new tab on your screen, as shown in Figure 3-4.

Figure 3-4: A portion of the query results.

Queries can sometimes be blocked by Access for security reasons. If thishappens, go to the Message Bar, click Options, click Enable this content and

Page 22: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

click OK. You can avoid this issue by creating a trusted location as describedin Lesson 2.

Saving the results of a query

When you save a select query, you're generally saving the design of thequery—not the results. That's because tables and other underlying informationoften change, making the results of a query different each time it's run. To saveresults, you must create a make table query. This process creates a separatetable to hold the results of your select query.

To save the results of a select query, follow these steps:

Open a query in Design view.1.Click the Make Table button in the Query Type group on the Design2.tab.In the Make Table dialog box shown in Figure 3-5, type a name for your3.new results table. Leave the Current Database option selected tocreate the table in the current database, or select Another Databaseand browse to select a different database in which to save the newtable. Click OK.

Figure 3-5: Make Table dialog box.

On the Design tab, click Run in the Results group.1.A warning dialog box appears, stating you're about to paste rows of data2.into a table. Once you paste the rows, your action can't be undone.Click Yes.

Your information is pasted into the new table. Go to the Navigation Pane andfind your new table in the list, and then double-click it to open it. View the dataand close it. In the next section, you'll learn how to create a union query.

 

Creating a union query

A union query lets you view all records from two similar tables. For example, ifyou want to send out a newsletter to suppliers and customers, you can use aunion query to create a single query that contains addresses for both groups.

A union query uses Structured Query Language (SQL), which is aprogramming language. SQL uses text commands, called statements, toperform one or more actions. When you perform a union query, each statementmust contain exactly the same number of fields in exactly the same order. Forexample, if one of your statements contains Name, Address, Town and ZipCode fields, and another statement lists the Zip Code field before the Townfield, the query will fail.

Essentially, every query you build has underlying SQL commands—justselect SQL View to see the commands in text format.

If you decide to get serious about databases, by the way, and do your own

»  HP Everydaycomputing laptop PCs

»  HP Balanced mobilitylaptop PCs

Page 23: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

programming or perform advanced queries, SQL is a good language to learnmore about. However, you can still use union queries without much SQLknowledge. Let's walk through the steps of creating a union query to create thenewsletter list. We'll use the Customers and Suppliers tables from theNorthwind 2007 database for this example of a union query. Follow thesesteps:

Click the Create tab.1.Click Query Design in the Other group.2.The Show Table dialog box appears. Click Close without selecting any3.objects.On the Design tab, in the Query Type group, click Union.4.At this point, Access switches from Design view to SQL view. In the5.blank center section of the query window, you'll enter some simple SQLcoding.Type SELECT on the first line in the blank window and press the6.spacebar.Next to SELECT, enter field names from the first table Access should7.query, using brackets [] to enclose each field name. In this example,enter [LAST NAME],[FIRST NAME] and use a comma to separate thefield names.Press Enter to move the cursor to the next line.8.Type FROM and press the spacebar. Type the name of the first table9.(for this example, type SUPPLIERS) you want to query.Press Enter to move to the next line.10.Type UNION and press Enter.11.Type SELECT, press the spacebar and then enter field names from the12.second table Access should query, using brackets [] to enclose eachfield name and a comma to separate the field names. In this example,enter [LAST NAME],[FIRST NAME].Press Enter to move to the next line.13.Type FROM, press the spacebar and then type the name of the second14.table (CUSTOMERS) Access should query.Press Enter to move to the next line.15.Type a semi-colon to denote the end of the query. Your query should16.look like Figure 3-6.

Figure 3-6: Sample SQL coding for a union query.

To save your query, right-click the Query1 tab and select Save. In the1.Save As dialog box, enter a name for your query (such asqryUnionSample) and click OK.On the Design tab, click Run in the Results group.2.

The results for this example are shown in Figure 3-7. Access pulled last namesand first names from two tables—Suppliers and Customers—and combined theminto one results set. Close the query when you're finished.

Page 24: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 3-7: Union query results.

It's a lot of steps, but each one is fairly simple as long as you enter theinformation correctly. Go slowly, and check Microsoft Office Access Help if youget stuck. (To open Microsoft Office Access Help, click the question markbutton in the upper-right part of the Access 2007 window.) In the next section,you'll learn how to create and run an update query.

 

Creating and running an update query

Update queries enable you to change all data in a set of records. If you need tochange data in one or more existing records, this is the type of query youshould use. An update query accepts multiple criteria, which means you canupdate a large number of records at once and change records in multipletables at the same time.

Follow these steps to practice working with an update query in the Northwind2007 database:

Click the Create tab.1.Click Query Design in the Other group.2.In the Show Table dialog box, select the table(s) with the records you3.need to update. For this example, select Customers. Click Add.

You can add multiple tables by repeating Step 3 until all the tables you needhave been selected. The tables appear as separate windows in the querydesigner window.

Click Close.1.In each table window, double-click the fields you want updated. They2.appear in the lower pane in the Field row. For this example, double-click Last Name, City and State/Province.

Renaming a query

There might be occasionswhen you need to rename aquery, perhaps to make iteasier to remember. To dothis, use the down arrow inthe Navigation Pane andclick Object Type. OpenQueries. Right-click thequery you want to renameand click Rename. Type inthe new name and pressEnter.

»  HP iPAQ handhelds

»  HP Handhelds

Page 25: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 3-8: The lower pane in the query designer window for an update query.

Enter criteria as needed in the lower pane. For example, type Not "C" in1.the Criteria field under Last Name to find all name records except thosethat begin with C. Type Not "Boston" to find all city records exceptthose in Boston. Type Not "CO" to find all state records except those inColorado. The designer window lower pane now should resembleFigure 3-9.

Figure 3-9: Criteria entered for the query.

Save the query, naming it qryUpdateSample.1.On the Design tab, click Run in the Results group. Verify the query is2.returning the proper records. Now, let's adjust the fields to returndifferent records at this point—this is where you can actually update therecords.Return to Design view.3.Clear the criteria from the three Criteria fields, and enter Portland in the4.Criteria field in the City column. Click Run to verify that two records arein the results set. Notice that both records show "OR" in theState/Province field.Return to Design view.5.On the Design tab, click Update in the Query Type group. Note that the6.lower pane now includes an Update To: line as shown in Figure 3-10.

Figure 3-10: Update To: line.

Determine the field containing the data you want changed. For example,1.let's assume a sales person mistakenly entered "OR" for Oregon in theState/Province field for each instance of Portland when the data shouldbe "ME" for Maine. Type ME in the Update To: cell in the State/Provincecolumn. Access automatically enters quote marks around the entereddata.On the Design tab, click Run in the Results group.2.When the alert message appears indicating two records are about to be3.updated, click Yes.

If the message indicates fewer or greater than two records will be updated,there's an error in your query. Click No, review the steps, fix any errors andclick Run again.

The query runs and the data is updated.1.

Be careful when using update queries—they can set data in one or more fields

Page 26: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

to a null value, which essentially deletes a portion of a record. However, anupdate query can't delete entire records from a database.

Now when you open the Customers table, as shown in Figure 3-11, theState/Province field shows "ME" for each Portland entry.

Figure 3-11: Updated State/Province records in the Customers table.

Enlarge image

See how to create and run an update query.

Moving forward

Take the time to practice with queries in the Northwind 2007 database. As youget comfortable with them, you'll see that they're easy to work with, and you'llwant to use them a lot when you use Access 2007. In Lesson 4, you'll discoverhow to work with forms, which are a great way to achieve simplicity in Access2007. Before you move on, however, don't forget to take the quiz and completethe assignment.

Assignment #3

For this assignment, you'll create a simple select query. Follow these steps:

Open your MyMovies database in Microsoft Access 2007.1.Click the Create tab, and then click Query Wizard in the Other group.2.In the wizard, select Simple Query Wizard and click OK.3.Select the Movies table in the Tables/Queries list.4.Move these fields from the Available Fields list to the Selected Fields list: MovieID, Title,5.MyRating. Click Next.In the next screen, change the title to qryMovieRatings. Leave Open the query to view6.information selected. Click Finish.

All of the records in your database appear with just the MovieID, Title and MyRating fieldsshown. Let's narrow down the records that display by selecting only those movies with a ratingof E (excellent). To modify the query:

Right-click the qryMovieRatings tab and select Design View.1.In the Criteria field for MyRating, enter E.2.Click Run. Now just the records with a rating of E appear in the results set.3.Save the query, close the database and exit Access.4.

 

Quiz #3Question 1:True or False: A query is a request for data results or a specific action based on certain data.

A) True

B) False

 

Question 2:True or False: Queries use constants to determine the answer for you.

Page 27: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

A) True

B) False

 

Question 3:Which tool walks you through the steps of creating different types of queries?

A) Query designer window

B) Query Wizard

C) Make Query Wizard

D) The Update To field

 

Question 4:True or False: When you save a select query, you save the results and not the commands and criteria.

A) True

B) False

 

Question 5:Which type of query changes all data in a set of records?

A) Union

B) Select

C) Append

D) Update

 

Microsoft Access how to: work with formsWhen you use a database, you want it to be as simple as possible to enter, edit or display data. Forms are thebest way to achieve simplicity in an Access 2007 database. This lesson shows you how to create, modify anduse forms.

 

Understanding forms

Welcome back. Now that you've completed Lesson 3 and are familiar withquery basics, you're ready to learn to create and use forms in this lesson.

When you use a database, you want it to be as simple as possible for anyoneto enter, edit and display data. In Microsoft Access 2007, forms are the bestmethod for accomplishing this. In addition, you can use forms to control accessto data.

Because a database can contain millions of records in some cases, controllingaccess can be quite critical. You don't want everyone who has access to thedatabase, for example, to be able to view, modify or delete all of the records.Perhaps you want only certain people to see certain information in thedatabase—health care providers, for instance, might want the receptionist tosee the name and identifying information of a patient but not all of the patient'sconfidential health records. That's where forms can come in handy. Theyenable you to show users only specific fields and records, and hide the rest.

The beauty of forms in Access 2007 is that you can include buttons andother easy-to-use functions that automate frequently performed actions.This makes it easy for people to use the database, enter or retrieve theinformation they're allowed to work with and move on.

In a purchase order, for example, you want only a sales representative to enterthe product name, quantity and cost of each unit. No problem—you can create asimple form as shown in Figure 4-1 to give the sales representative a drop-down product list, a related unit cost and the ability to enter the exact quantityneeded.

»  HP Performance laptopPCs

»  HP Performance andentertainment laptopPCs

Page 28: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

Figure 4-1: An example of an input form.

Enlarge image

You can always manually create a form in Access 2007; however, the FormWizard makes it such a simple process that we'll focus on that in the nextsection.

 

Creating a form with the Form Wizard

To create a form using the Form Wizard, follow these steps:

Open the Northwind 2007 database in Access 2007.1.Select the Purchase Order Details table in the Navigation Pane—you2.don't have to open it. (You could also select a query, but let's stick witha table for this example.) This will be the foundation for your form.Click the Create tab on the Ribbon.3.Click the More Forms button in the Forms group.4.Select Form Wizard from the menu.5.In the Form Wizard, select specific fields in the Available Fields list and6.move them into the Selected Fields list using the horizontal arrows.Don't forget to use the single horizontal arrow; not the double arrows.For this example, select Purchase Order ID and Date Received, asshown in Figure 4-2. Click Next.

Figure 4-2: Selecting fields in the Form Wizard.

The next screen prompts you to select a layout for your form: Columnar,1.Tabular, Datasheet or Justified. Click each option to see a preview ofthe layout. For this example, select Columnar and click Next.The next screen prompts you to select a style for your form, which2.mainly affects the color of components within the form. Click some of theoptions in the list of form styles to see a preview of each one. For this

»  Slim and sleek desktopPCs

»  HP Thin clients

Page 29: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

example, select Northwind and click Next.In the next screen, type frmPurchaseOrder as the title for the form.3.Ensure the Open the form to view or enter information option isselected and then click Finish.

The form appears on your screen, as shown in Figure 4-3.

Figure 4-3: The frmPurchaseOrder form.

At the bottom of a form is a Record section on the status bar. You can use thehorizontal arrows in this section to move swiftly through records in the form ifyou need to.

To enter data into a form, just open it and click the New (blank) record buttonon the status bar, as shown in Figure 4-4. Type new information as needed,using the Tab key on your keyboard to move through the fields for eachrecord.

Figure 4-4: The New (blank) record button.

In the next section, you'll learn how to work with Design view when creatingforms.

 

Working with Design view to create forms

When you open a form, you can't see the underlying structure and format usedby the form. There's a way to get to that data, however: use Design view. Thisview gives you a detailed view of the structure of your form and enables you toplace boxes in different areas and see headers, footers and other details.

Figure 4-5 shows the purchase order form you created earlier in the lesson inDesign view. In this view, a Field List pane appears on the right side of yourscreen, enabling you to quickly access and edit tables and fields related to yourform.

Figure 4-5: Your purchase order form in Design view.

Enlarge image

»  Microsoft Access

Page 30: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

When creating forms, you'll often want to add additional fields to a form. To doso, you need to first expand the size of the form and then add the fields. Moveyour cursor to the right edge of the form, and then click and drag the form out afew inches. Do the same to the bottom of the form. The Form Footer might becovering the bottom edge. Hover your mouse pointer over the top of the FormFooter bar until the pointer turns to a solid line with double arrows, as shown inFigure 4-6, then click and drag down.

Figure 4-6: Enlarging a form in Design view.

Once the form has been expanded, you can add fields in one of two ways:using the Design > Tools > Add Existing Field commands on the Ribbon orby dragging fields directly from the Field List pane onto your form. The secondmethod is the easiest; we'll use that one.

In the Field List pane to the right of your form, click and drag the Posted toInventory field into the Detail section below the other two form items. Left-clickand grab the field to move it exactly where you want it; your cursor will look likea four-sided arrow as you do this. To move the label independently from thecheck box, grab the brown box in the upper-left corner of the check box, asshown in Figure 4-7.

Figure 4-7: Brown boxes on the newly added field.

Move the check box to the far right of the input form. Grab the brown box onthe label, move it into place under the Date Received label, and then drag thecheck box under the Date Received input box. The form should resembleFigure 4-8.

If part of the field becomes obscured, you can easily click it and pull to changeits size for easier viewing.

Figure 4-8: The input form with a new field added.

Very quickly, let's take a look at adding controls to your form. Controls areobjects (such as a check box, which you've already seen) that display data,perform actions and enable you to label and place images in your form. Manydifferent types of controls are available, but the most commonly used control isthe text box.

Click the Form Design Tools Design tab on the Ribbon, and then click the

Page 31: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

checkmark box in the Controls group. In the same group, click the SpecialEffects button and select Special Effect: Etched. Now, move your cursor tothe Detail section of your form. When the cursor turns to a plus sign, draw thecontrol box on the form.

You can add many other types of controls using this general process. Take afew minutes to review the Controls group on the Ribbon to see the optionsavailable.

You can see how easy it is to manipulate forms using Design view. In the nextsection, you'll learn how create a split form.

 

Creating a split form

There's a new way to create forms in Access 2007—it's called a split form. Thisis a single form that offers you a dual view of your data: Form view andDatasheet view. The two views are synchronized; when you select a field inone area of the form, the same field is selected in the other part of the form.You can add, edit or delete data in either part of the form.

Split forms are useful because, for example, you can use one part of the form(Datasheet, for instance) to locate a record and then use the Form view to editthe record.

To create a new split form using the Split form tool, follow these steps:

In the Navigation Pane, select the table or query you want to use. For1.this example, let's use the Employees table in the Northwind 2007database.Click the Create tab, and then click Split Form in the Forms group.2.

Your screen should resemble Figure 4-9. The Employees form comprises thetop section of the window; the datasheet for the form is located on the bottom.

Figure 4-9: A split form.

Enlarge image

As you can see, split forms are a really easy way to work with your data. Trythem out on other tables and queries, too.

See how to create a split form.

Moving forward

»  HP TouchSmartdesktop PCs

»  HP Business desktopPCs

Page 32: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

That wraps up the lesson and the class. You learned how to use the Access2007 Ribbon and commands, and create databases with tables, queries andforms. As you work more and more with Access, you'll discover that Access2007 can simplify a lot of work for you when you work with complex sets ofdata. Before moving on, don't forget to take the quiz and complete theassignment to reinforce important topics learned in this lesson.

Assignment #4

For this assignment, you'll create a form using the Form Wizard. Follow these steps:

Open your MyMovies database in Access 2007.1.Select the Movies table in the Navigation Pane.2.Click the Create tab.3.Click More Forms in the Forms group.4.Select Form Wizard from the menu.5.In the Form Wizard, click the double arrow button to move all fields from the Available6.Fields list to the Selected Fields list. Click Next.Select the Tabular layout for the form. Click Next.7.Select the Flow style for the form. Click Next.8.Type frmMyMovies as the title for the form. Leave the Open the form to view or enter9.information option selected. Click Finish.Test your form by entering three additional movies into the form. If you need to modify10.any part of your form, right-click the frmMyMovies tab, select Design View, makechanges and then save your form.Close the form, close the database and exit Access.11.

 

Quiz #4Question 1:True or False: You can use forms to show users only specific fields and records in a database or queryresults set.

A) True

B) False

 

Question 2:True or False: When you open a form, you can see the underlying structure and format used by theform.

A) True

B) False

 

Question 3:Which type of form lets you see an input form in the top part of the window and the associateddatasheet in the bottom part of the window?

A) Design

B) Split

C) Control

D) Stacked

 

Question 4:True or False: When you use a split form, you can use one part of a form to locate a record and anotherpart of the form to edit the record.

A) True

B) False

 

Question 5:True or False: When you work in Design view, you can add controls to your form.

A) True

Page 33: Microsoft® Access 2007: introductionlouiseteach.weebly.com/.../4/4754310/2010_revision_of_os_2007_les… · 3. Microsoft Access how to: create and use queries In this lesson, you'll

B) False

 

© 2003 - 2009 Powered, Inc.