You are on page 1of 18

INTRODUCTION Access is relational database management system application software because the data within a database is related to one

another. What is a database? A database is basically a table with headers that contain related information. Data in a database is presented in rows and columns, just like a spreadsheet. The difference here is that the data in a database can be presented and reorganized in various ways, using reports and query. Some example of what u can do in Access is creating inventory system, payroll system and accounting system. ELEMENT Tables DESCRIPTION Tables are structures that contain your data. Tables are represented as rows and columns. When a new table is created, you will need to define fields (column headings), that is unique in nature and the data type (i.e. text, numbers, date, etc). Each new row inserted to a table is called a record. Queries are sets of instructions that will display records that match certain criteria. For example, a query could be fine-old-makes of cars made in 1998 in France. Queries can also be used to sort data by the selected fieldname in alphabetical order, or ascending, or descending order. Forms are screens that display only one record at a time, with a different field on each line. It can be used to input data in tables too. If you intend to control how records are sorted, you need to define a query first and create a form based on the query. Reports are output from queries. It is usually in printed form. Macros allow you to perform automated repetitive operations without a need of programming by invoking a set of command. It is a script for performing certain task. Modules contain some basic programming code to perform operation that cannot be handled through macros. The user will need to write his/her own functions.

Queries

Forms

Reports Macros Modules

In this exercise you will be able to create a customer database system. This is important to organize the information of customer such as address, contact number and current order. In order to create the database, students should do some sketch on what of the content of the database that they need to show. The diagram below shows the sample of sketch for this exercise. Create new database 1. 2. Select File from the menu bar > New Activate / Click Access Database. The following dialog box will be displayed.

3. 4.

Type file company database in the file name box and save in students folder. Then click create button. The following company database dialog box will be displayed.

Designing Table Before creating a new database, it is best to plan the database structure and the fields that will be used, not forgetting the primary key. A primary key is a unique identifier for each record. It allows you to separate your data into several tables that can be linked together using the primary key. This method removes the redundant data. In the following example, we shall learn to create a simple database and enter the relevant data. The data that will be entered is as follows.

Field cid (Primary key) Title Name Occupation Address Phone no Fax no Email address

Data Type Text Text Text Text Text text Text Text Table 1 : customer

Field Size 3 5 50 15 100 15 15 30

i. Using the customer database, select tables then double click create table in design view option
as it is created.

ii. The table1: Table design view will be displayed as below.

iii. Fill in the Field Name, Data Type and Description column (refer to Table 1 : Customer) iv. Double click cid field name to create Primary key v. Save as table1 as customer. vi. Repeat step i. to iv. to create Order : table and Item : table based on the data below.

Field No (Primary key) Customer id Code Product description Quantity Price Delivery

Data Type Autonumber Text Text Text Number Currency text Table 2 : Order

Field Size 3 3 50 100 20

Field Code (Primary key) Item Price Company Image

Data Type Text Text Currency Text OLE object Table 3 : Item

Field Size 3 15 100

vii. All tables should be displayed in Design View as below.

Building, inputting field, sort and determining criteria A Query is a set of instruction to view and analyze data in many different ways. The simplest method to create a query is using the Query Wizard.

To create a query:

1. 2.

Open the student customer databese. Click the Queries button from the customer database.

3.

Double click Create query by using the wizard.

4.

The Simple Query Wizard dialog box is displayed.

5. 6. 7.

Click on to select all fields in the Available Fields box to the selected field box. All the fields will be displayed in the query.

Click the Next button. The following Simple Query Wizard dialog box is displayed. Click the Finish button.

8.

The Customer Query table is displayed as illustrated.

9.

Close the Customer Query table.

Selecting Criteria in a query

1.

In this example, students will learn to add some criteria to an existing query. Select the custom query from the customer database.

2. 3.

Click the Design button,

and the custom query criteria table is displayed.

Uncheck the Show box in the title and type A* in the criteria box of the name field columns as illustrated.

4.

Click the View button drop down list and select Datasheet View.

5.

Observe that the title fields are not displayed. The custom query will show the customers name begin with the letter A.

6. 7.

Click on the View button. The mode is changed back to the criteria table. Check the Title check box and delete the criteria. Save the custom Query.

What are forms? Forms allow you to work with one record at a time on the screen. It is used to input data complete with menus and other buttons. Just like a report, forms can be created from scratch or using the Form Wizard. Creating a columnar form

1.

In customer database, click on the Forms Objects.

2. 3.

Click the New button. Select the AutoForm Columnar option from the available list.

4.

Select customer from the Choose a table or query drop down list.

5. Click OK. 6. The customer columnar form is created as follows.

7. Click the Save button. The Save as dialog box is displayed. Type Customer Information in the Form
Name text box.

8. Click OK. 9. Now you can insert data of the customer. To insert a new record into the form, click on the insert new
record button at the bottom of the form.

Click here
10. You are now ready to begin inserting new records in the following screen.

11. Close the customer form window. 12. Repeat steps 3 to 9 and create columnar form for item table. 13. The Item Form is illustrated as follow.

Creating a form from scratch.

1. 2.

To create a form from scratch and edit it later, try the following example. Double Click the Create Form in Design View The following screen is displayed.

3.

Save as Main Form. Adding an image to the form.

1. 2.

Click the Toolbox button. The Toolbox toolbar is displayed.

10

3. Click the image button on the toolbox toolbar. 4. Draw a rectangle to the right of the Main Form.
5. Right click on the rectangle and go to properties as shown below.

6. Insert an image (the logo of your company)

7. Observe that the screen bean is not displayed in full. To display it in full, double click on the image. The
image window is displayed.

11

8. Click anywhere within the size Mode text box to activate the drop down list. Select the stretch from the
Size Mode drop down list. Observe the image now. It should fit the rectangle created.

9. Click the Line / Border Color drop down list button while the image is selected.

10. Click on transparent. 11. To insert button, Click the command button on the toolbox toolbar 12. Draw a rectangle in the Main Form to create the command button. Type the name of the command button. (Create five command button as Customer, Item, Exit and Print Customer Report )

12

13. The Main Form design view illustrated as follow.

CANCEL

14. Click the

button to view the Main Form.

CANCEL

15. Save Main Form

13

Adding Visual basic programming Formatting button

1. 2.

Open Main Form in design view. Right Click on customer button and select Properties. The Command Button:Command1 is displayed as below.

3.

4.

Select On Click and Click

button. Select Code Builder and Click OK.

5.

The Company- Form_Main (Code) is displayed.

14

6.
7.

8.

Type the highlighted text in your Company:Form_Main (Code) box. Repeat steps 2 till 7 for other command button. Save Main Form.

Startup Form Startup Form is the command that use to display Main Form automatically when the database is running.

1. Open Main Form in design View. 2. Go to Tool Menu and select Startup.

15

3. The Startup Dialog Box is displayed as follow. Type Main in Display Form/Page box.

4. Save Main Form

What is a report? People are sometime frustrated having to look at the data on the screen. A few reports that might be useful to management or lecturer such as customer information list and a summary of current order, so the printed reports can distribute for discussion in meetings and any used in future. CREATING REPORTS Creating a columnar report 1. Click on Reports Objects.

2.

3.

Click the New button Select the AutoReport: Tabular option from the available list in the New Report dialog box.

16

4.

Select student info from the Choose table or query drop down list as illustrated.

5. 6.

Click OK The customer columnar report is generated as follows.

7. 8.

Click the Close button. Click the Save button. The Save As dialog box is displayed. Type customer report in the Report Name text box.

9.

Close MS Access.

17

18

You might also like