Welcome to the third and final part of our series on the basics of Microsoft’s Access 2000. In part one, I discussed how to create a table. In part two, I showed you how to form relationships between multiple tables. Now that all of the tables are filled with data, it’s time to learn how forms can help you manipulate this data.
If you have been following along with my sample database (or creating your own), you should now have three tables (Address, Birthday, and Phone). Now that your data has been entered, wouldn’t it be nice to just enter a person’s name and have his or her address pop up? In order to accomplish this, as well as several other tasks, we will create simple forms that will allow you to manipulate the data that you have entered. You can create these forms on your own or you can click here to download our sample database for this series.
Creating an address form
From the main screen, click on the Forms tab, and then click Create Form By Using Wizard (see Figure A).
|Using the Form Wizard is as easy as one, two, three.|
After choosing Form Wizard, you are prompted to select which fields you want to use from which table. Right now, let’s just create a form dealing with the data in the Address table. Hit the >> button, and all of the field names will be transferred over to the Selected Fields side of the screen (see Figure B).
|You can use all or just some of the fields.|
After clicking the Next button, you are prompted for a style as shown in Figure C. For our exercise, choose Columnar and click Next.
|We’re using Columnar, but don’t be afraid to experiment.|
Then choose a form style (see Figure D) and click Next.
|The Style controls the form’s color scheme and background.|
Now it’s time to name your form. Let’s use “Address” to keep things simple. It’s all right to name both the table and form the same thing. Choose Modify The Form’s Design after you name the form and click Finish (see Figure E).
|Click Finish to see your new form.|
You should now see your new form design window (see Figure F). Expand the boundaries of your form by clicking on the edges and dragging them outward.
|You can easily edit your form from the design window.|
On the design screen, you will see the data that will be displayed on the form. Let’s add some buttons that allow you to add a person to the database, delete a person from the database, and search the database for a specific individual.
Adding buttons to your form
Select the Command Button from the Toolbox (see Figure G). Once you do this, your cursor will change shape.
|The Form Design toolbar should appear when editing your forms.|
Click on the form, hold, and drag to create a small area that will be your Add button. Under Categories, select Record Operations (see Figure H). Then select Add New Record and click Next.
|This button will add a new record to the database.|
You can now choose to have either text or a picture on your button. For simplicity’s sake, let’s go with the text as shown in Figure I. Click Next to continue.
|The words “Add Record” will be displayed on the new button.|
You will then be prompted to name your button (see Figure J). For this example, let’s name the button “Add.” Click Finish and voila! The Add Button is created.
|Give the button a name that describes its function.|
Follow these same steps to create Delete and Search buttons, but choose Record Operations–Delete Record and Record Navigation–Find Record, respectively.
Now that all three buttons have been created, close the Form window and save the design. You can now double-click on the form to use it. Figure K shows the finished form. Be sure to test your new buttons. Testing is always an important step when creating a database.
|The completed Address form|
When you test your Search Button, you will notice that when you enter a search command, you are searching the first name field. If you would like for the form to search by a different field, you must place that field at the top of the Selected Fields list when creating the form.
Creating a birthday form
You can create a Birthday form by following the previous steps, but you will not be able to add a record using this form. This is because our relationships, created in the last article, do not allow a record to appear anywhere unless it first appears in the Address table. If you don’t want your address book to behave in this fashion, you will have to change the relationships between the tables.
Now, open up your Birthday form (shown in Figure L) and test the buttons. The first name, last name, and birthday should all correspond with the phone numbers for that person, even though you did not include the first and last names from the Phone table. This is also due to the table relationships.
|The completed Birthday form|
That should get you through the basics of Microsoft Access. As you might imagine, the possibilities are nearly endless concerning what you can do with your data. Keep practicing and don’t be afraid to experiment!
Do you have a great Microsoft Access tip that would benefit your fellow TechRepublic members? What do you think of Jason's introduction to Access 2000 series? Post a comment or write to Jason and let him know.