You are on page 1of 20

Quick Access to MS ACCESS

Basic Database Management System


MartzelBaste

11

Microsoft Access - Introduction


Microsoft Access was created to help people efficiently store and retrieve all types of information. Microsoft Access users store data ranging from customer satisfaction to monthly sales to the annual rainfall in the Sahara Desert. Microsoft Access - Overview Microsoft Access stores information in what is called a database. For now it is good enough to know that your data is put into a database and not worry about the details. We will be explaining databases and other key Access elements in a later lesson. There are four major steps to using Microsoft Access: 1. Database Creation: Create your Microsoft Access database and specify what kind of data you will be storing. A retail business might create a database to store all their sales information (i.e. items sold, customer, employee, commission, etc) 2. Data Input: After your database is created the data the store gathers every business day can be entered into the Access database. 3. Query: This is a fancy term to basically describe the process of retrieving information from the database. 4. Report (optional): Information from the database is organized in a nice presentation that can be printed in an Access Report. Tizag's Microsoft Access tutorial will guide you through each of these steps and teach you some nifty tips and tricks along the way. If you are ready to learn more about Access please continue. Access Database: Overview The building block of Microsoft Access is the database. If you have never heard this term before, don't worry about it because we're going to tell you all about it! The name database is actually a very descriptive name. The database is two things in one:

Data...: A place to store your data. This data could be a record of sales, employees, salaries, or anything else. ...base: It is the basic building block that many other features in Access use to function. With a properly created database you can create informative reports about the data, custom charts to visually display values, and create queries. These items will all be covered in more detail later. Without a database filled with data you can do...nothing.

A database is a little bit more complex than some think it should be. You cannot enter data into a database without first creating a table. A table belongs to a database and it is in these tables that you enter information. We will be discussing tables in the next lesson! A Real Database Example People use Access for various reasons, but let's assume someone named Bob is using it to store information about Bob's Shoe Store. Bob gathers raw information about shoes sold from a cash register then he manually types this data into Access. Now the tricky part, of course, is where does he enter this data? Well, before Bob can dive right into the inputting data, he must first create a Access Database that will hold his information. It's time for Bob to learn some Access (and you too)! Creating an Access Database Bob wants to store information in Access, but doesn't know how many databases he needs to create! Although you may require many databases in the future, it is usually sufficient to have one database per project. This means Bob should have one database for his business, but would need a separate database if he wanted to store his family's information. To create new databases in Access follow these steps: 1. Start Access 2. From the menu choose File < New 3. The "New File" side bar will be displayed on the right-hand side of the screen

4. Left-click the option "Blank database...", which will then ask you to name your database. Helpful Hint: Access databases are saved with the .mdb extension.

5. Name your file (we chose TizagDB) and press Create. This will automatically save your blank database, so remember where you put it!

6. The Access Database interface should now be displayed and you are well on your way to learning Access!

Now that the database has been created we can begin to create our first Access Table. A table resides within a database and holds information specific to a certain area. We will talk more about this in the next lesson, Access Tables. Access Tables Now that Bob has created his Access Database he can now make a table. A table is where data is stored and a table lives within a database. Without a database there can be no table! A table in Access is quite different then a table in real life. Instead of having wooden legs and being used for meals, Access Tables are a grid made up of rows and columns. Here's an example of a table in Access:

There are for key components we want you to learn right now: 1. tbl_Sales: The name of our table is the example is "tbl_Sales". Note that we could have simply called our sales table Sales, but by including a prefix tbl_ there is absolutely no confusion and is a great Access habit to pick up! 2. Columns: A column is one vertical section of the table (i.e. up-and-down sections). The vertical columns have their label at the top and these labels should describe the type of information that will be stored. The columns in this table are: Employee, Product, Price and SaleNumber. 3. Rows: A row is one horizontal segment of the table (i.e. left-to-right sections). One record takes up exactly one row. For example, in this table one sale at Bob's Shoe Store was a pair of slippers, which sold for $5.00. This record was entered left-to-right as follows: Employee-Bob, Product-Slipper, Price-$5.00, SaleNumber-3. 4. Cells: A cell is simply the intersection of a row and a column. Can you find the cell that contains the value $150.00? Which row and column intersected at this cell? When you enter information into Access it will often be one cell at a time! These definitions may seem confusing at first and if that is the case, please read through this lesson, play around in Access then revisit this page to seem if it is starting to make more sense. If you stick with it you'll be amazed at how much you can learn! Now that we've covered the basics of Access Tables let's actually create one! Creating an Access Table When you create a table in Access you have to know what the table will store and what format that information will be in. For example if you wanted to store the product identification numbers involved in a sale, then you might label that column "ProductID" and specify that only numbers should be stored for that column. We'll be creating the table tbl_Sales that you saw above, but remember this is only the table creation stage and we will not be entering data just yet! 1. With the Tables object tab selected, double-click the "Create table in Design view"

2. This will bring up the Table Design View

3. There are three columns here that should be explained in detail: o Field Name: This is where you type the name for your column. A common practice is to make it one word and to use capitalization for multiple words squished into one (e.g. SaleNumber) o Data Type: This column is where you specify the type of data that will be stored. If you are storing money then select Currency. The most common types of data are: Text, Number, Currency and Date/Time. o Description: Here you can type optional notes to remind yourself or provide useful information for others who might be viewing this file later. 4. The first column in our tbl_Sales example was Employee, so let's enter in Employee in the Field Name column and choose Text from the Data Type column. If click inside the Data Type column you will see that it is actually a drop down select box with many options to choose from. Select the Text option.

5. Enter the following information for our remaining three columns of tbl_Sales: o Field Name: Product, Data Type: Text o Field Name: Price, Data Type: Currency o Field Name: SaleNumber, Data Type: Number

6. Before we are finished here, we need to make a Primary Key. A primary key is restriction that we place on a column stating that there can be no duplicate values in that column. We will be talking about keys later, but for now right-click in the SaleNumber row and choose Primary Key from the pop-up menu.

7. We have finished our table's outline so click the X in the top right to close the design view (don't close Access, just the Design Window).

This will also bring up a prompt to name your Access Table. 8. Click yes and enter "tbl_Sales" for your table's name.

Although this process of creating an Access table might seem overly complicated, with time you'll be able to create and edit existing tables very quickly. Feel free to revisit this page if you are having trouble creating an Access table. The Next Step: Entering Data (Records) People use Access for various reasons, but let's assume someone named Bob is using it to store information about Bob's Shoe Store. Bob gathers raw information about shoes sold from a cash register then he manually types this data into Access. Now the tricky part, of course, is where does he enter this data? Well, before Bob can dive right into the inputting data, he must first create a Access Database that will hold his information. It's time for Bob to learn some Access (and you too)! Creating an Access Database Now that we have completed the construction of our table we can finally begin to enter in our sales information. The next lesson will talk you through the process of entering data into an Access table.

Access Records With our sales table created we can begin to enter our gathered sales data from Bob's Shoe Store. A record is simply one entry in a table. You enter data into a table from leftto-right and you can only enter one record per row. To begin entering records, double-click the table you want to add records to. 1. Double-click the table tbl_Sales

2. This brings up the Table Window and you can see that our table contains no data, yet.

3. Bob's five sales are as follows (note: Bob is currently the only "employee"): 1. Sneaker - $40 2. Sneaker - $60 3. Slipper - $5 4. Heel - $12 5. Dress - $150 4. Enter the information for Bob's first sale as follows: o Employee: Bob o Product: Sneaker o Price: $40 o SaleNumber: 1

Enter the remaining four sales so that your table looks like:

You're done entering the data! Close the table and get ready for the next lesson! Adding records is pretty easy and you would hope so because you will probably spend the bulk of your time in Access simply doing data entry into your Access databases. Having our data in place, we can now begin to do some basic Access Queries to get useful information from our table. The next lesson will give a basic overview of what a query is and how to use them. Access Query As tables grow in size they can have hundreds of thousands of records, which makes it impossible for the user to pick out specific records from that table. Queries were designed to combat this problem. With a query you can apply a filter to the table's data, so that you only get the information that you want. The tricky part of queries is that you must understand how to construct one before you can actually use them. This lesson will guide you through the basics of making a couple very simple Access queries. Choosing a Table to Query Before you can create a query you have to navigate to the Query Tab in your Access database. Select Queries from the Objects Pane.

Although you could use the Wizard, we will guide you through the process of creating an Access query with the "Design view". We feel this is helpful for beginners, so they don't feel overwhelmed when they need to do something the Wizard doesn't allow them to.

1. Double-click "create Query in Design view" 2. Add the table tbl_Sales

3. Your Query window should now have the tbl_Sales table added to it

You have just completed the setup process for making a query. Every time you make a query you have to first choose which table(s) you want to select data from. Currently, our database only has one table, so we don't have a lot of choices here. Now we can begin to create our custom Access query. Creating a Custom Query Bob wants a query that will just return the list of items sold and for how much. He doesn't care about the sale number or the employee. To make this query we are going to have specified the fields we want to see and ignore the others. Access lets you quickly select fields you want to see by a simple drag and drop method. For ever field that a table has there is an entry in the quick table viewer. Notice that the quick view of tbl_Sales displays the fields: *, Employee, Product, Price and SaleNumber. Note: The field * is a wildcard, meaning it will select all the fields if you choose *. We only want Product and Price, so let's start by dragging Product down from tbl_Sales to the first column. Notice that when you drop the Product field into the first column it populates two of the fields and checks the "Show" box:

Drag and drop the Price field into the adjoining column and you should have something like:

That's it! You're done! Close the Query window and save your file query as qry_ProdSales.

Running Your First Query! Well you've finished writing the backend for your query, so let's if it works. Doubleclick your newly created query and you should see something like this:

Basic Query Review When you want to create a query that just uses a select few fields you can simply drag and drop these fields in design view. The next lesson will go into much more detail on creating custom queries, but remember this, you already have the knowledge to write queries in Access! Pretty impressive! Access Forms Access provides an easy way to enter data into your Access tables with forms. In Access you have the ability to quickly make and customize these data entry forms to streamline the data input process. Learning how to properly create an Access form will save you a great deal of time! Using our previous example, imagine that Bob, from Bob's Shoe Store, has recently hired someone to enter all the sales data at the end of each business day. The only problem is this person does not know how to use Access, so Bob needs to make them a custom form in Access! This lesson will guide you through the process of creating a data input form in Access Creating an Access Form Although we haven't recommended the various wizards that Access had available in the previous lessons, the form wizard is actually very useful and should save you a bunch of time! Let's create a simple data input form for the new employee! 1. Navigate to the Forms section in Access

2. Double-click "Create form by using wizard" 3. We want all of the fields from tbl_Sales to be included in this form, so first select tbl_Sales from the drop down box "Tables/Queries"

4. The single right arrow will add one selected field at a time, but we want all the fields. The shortcut to add every field from a given table or query is to click the double arrow button. Do that and click Next.

5. Choose a Columnar layout and press Next 6. Choose any style and press Next (we chose "Sumi Painting") 7. Change the form's title to frm_EmployeeEntry

and click Finish Open up your form and check it out!

Entering Data Using Access Forms Now that the form has been created, Bob just needs to teach his employee how to enter in the data. Lucky for Bob it's as easy as one-two-three and won't take him long to bring his new employee up to speed. 1. Open up frm_EmployeeEntry (easy!)

2. At the bottom of the form is a set of arrows to navigate through the records. To get to the end of the existing records and begin entering data you need to click the arrow with an asterisk(*).

3. Clicking that button will bring you to the first blank record, which would be the sixth in our case. You would then enter all the data for that record and click the right arrow to advance to the next blank record. After all the new records have been entered, close the form and pat yourself on the back. When you enter data into this form it will automatically add it to our existing tbl_Sales because we specified that table when we created our form. With this form the new employee will be able to enter data into Bob's existing Access table without ever knowing a thing about tables! Access Reports Having all your data stored in Access is great for maintaining a database, but it isn't the best when you want to share the data or view it away from a computer. The solution to this problem is to create an Access report that will let you design a ready-to-print document of your desired database information. Sticking with our example of business owner Bob, CEO of Bob's Shoe Store, let's explore how he would go about printing out a sales report that he can peruse on his flight to the annual Shoe Owner's of the World Convention (SOWC).

Creating an Access Report Bob wants a report to show the sales for each product, as well as the total sales for his company. Luckily, because he has all his sales information in an Access database, he can create this report in about a minute! Let's explore how you would create this basic sales report in Access. 1. Navigate to the Reports section in Access

2. Double-click "Create report by using wizard" 3. Select the query we created in the Access Query lesson qry_ProdSales and add both fields to the report.

4. Click Next 5. At the grouping step, add the Product field by clicking the right arrow and click Next

6. At the sorting step, select Price from the drop-down-box then click Summary Options ...

7. Check the Sum box, so the report will include totals for the Price field and click OK

and click Finish 8. Click Next to advance to the layout options 9. Choose a Stepped layout and a Portrait orientation, then click Next 10. At the Style screen choose Bold and click Next 11. Name the report rpt_Sales and click finish

and click Finish Open up your report and check it out!

Bob can now print out this handy report and review his sales in an easy-to-read fashion, while away from his computer. If you would like to make any changes to the report just right-click rpt_Sales and choose the "Design View" option from the popup menu. The Basics of Access Congratulations of completing the basics section of Access. Already you know how to make a database, tables, queries, forms and reports. However, there is still a great deal more to learn about Access and the following lessons will be covering some of these advanced topics. If you are ready to move on to the intermediate section, please continue! Access Charts Now that you know the basics of Access, you can start to learn the extras that are available to you. Access has a quick and easy chart generator that uses your transforms your existing tables and queries into something visual. This lesson will walk you through the process of creating a chart in Access.

Make Sure you have the Query In the Access Query Lesson we created a query to find the total sales for each type of product. We will be taking this query and making a histogram from it, so if you have not completed that lesson already, please do so. Finding the Chart Wizard The chart wizard can be found inside the Reports area of Access. Navigate to the reports are.

The chart wizard can be found by clicking the green New button and selecting Chart Wizard.

Choosing the Right Chart Our data consists of product types and total sales, so a histogram would probably be the best choice for this data. 1. With Chart Wizard selected, choose the Query "qry_ProdSales" from the drop down list. This is what our chart will be constructed from.

2. Click OK 3. Add both available fields to the chart and click Next.

4. Select the Bar Chart and press Finish.

5. Your new chart should look something like this:

6. Close the chart preview and save your chart as "cht_ProdSales"

This chart doesn't cleary show all the products, so we are going to have to widen it a bit.

Access Charts - Editing a Chart To make our chart wider we are going to have to edit design view. 1. Right-click on cht_ProdSales and select Design View 2. Click once on the graph to select it, you should see black dots around the grave, at the cardinal positions.

3. Click and drag the right dot so that the chart is now just a little before the vertical line.

4. Close design view and save the changes. The chart should now be wide enough to display all the titles of your products. If it still is not getting the job done, try adjusting the size again, or even selecting a different type of graph. To view your chart just double click cht_ProdSales.