Sie sind auf Seite 1von 11

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH

CAMPUS
Department Of Computer Science

LAB 15
Summary
Items
Course Title
Lab Title
Duration
Operating
System
/Tool/Language
Objective

Description
Database System
Switch Board
3 Hours
Windows Operating System/Microsoft Access 2007
To get familiar with Macros and SwitchBoard

Introduction to Sub queries


In this lab, we will explore with subqueries, list the types of queries, write single-row and
multiple-row functions.
Sub Query
A sub query is a SELECT statement that is embedded in a clause of another SELECT statement.
They can be very useful when you need to select rows from a table with a condition that depends
on the data in the table itself.
The sub query is ofen referred to as a nested SELECT, sub-SELECT, or inner SELECT statement.
The subquery generally executes first, and its output is used to complete the query condition for
the main or outer query.

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

The outer and inner query can get data from multiple tables.
Example:
The inner query determines the salary of the employee. The outer query takes the result of the
inner query and uses this result to display all the employees who earn more than this amounr
1. select fname from Table1 where salary>(select avg(salary) from Table1)
2. select fname from Table1 where salary>(select avg(salary) from Table1) and
job='operator'

Making a Switchboard
To get a programmer and user interface, you set up a switchboard as a menu for user. The steps for
setting up switchboard are followed:

I.

Set up a macro to run table, form, and report.


1. Click Create / Macro

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

2. Choose the Action

3. Select Action Arguments, for example, query name.

4. Save the macro

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

II.

Create a switchboard.
1. Click Database Tools / Switchboard Manager.

2. Click Yes

3. Click Edit

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

4. Click New

5. Type information of Text which will show on screen.

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

6. Select the command and additional information like which macro.

7. Make another New item:

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

Close the window twice.


III.

The steps for automatically starting up switchboard when database is opened in


Access 2007:

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

Microsoft Access Exercise 5


Use Macros and Switchboard to create programmer and user interface as the following.

Instructor Manual/Database Management System

BS(CS)

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

MAIN FORM:
Listed below are the steps in creating a main menu form.
1. Open your Microsoft Access.
2. Go to the create tab and click on blank form.
3. Create a label. To do this, go to the design tab and click on Aa. Type whatever label you want for
the form. You can change the color and size of the text on the home tab.
4. Create a button.
5. Go to the design tab.
Instructor Manual/Database Management System

BS(CS)

10

COMSATS INSTITUTE OF INFORMATION TECHNOLOGY WAH


CAMPUS
Department Of Computer Science

6. Click on xxxx, the item next to Aa.


7. Drag it where you want the button to be positioned.
8. The Command Button Wizard will pop up. It will ask you what action you want to happen when
the button is pressed.
9. Under the categories list, select form operations.
10. Under the actions list, choose open form.
11. Click the next button.
12. It will show you the forms you have created. Choose the one that you will be using for the menu
form.
13. Click the next button.
14. You will have to choose between: Open the form and find specific data to display or Open the
form and show all records.
15. Click the next button.
16. You have two options here. You either want to display a text or an image in your button.
17. Click the next button.
18. The wizard will let you have a specific name for the button that will help you identify it when
coding later.
19. Click the finish button.

Instructor Manual/Database Management System

BS(CS)

11