Anda di halaman 1dari 97

THE COMPLETE

Microsoft Access 2003


MODULE 4

CompleteVISUALTM Step-by-step Series Computer Training Manual www.computertrainingmanual.com

Microsoft

Access 2003

Module 4

Copyright Notice Copyright 2003 EBook Publishing. All rights reserved. No part of this publication may be reproduced, transmitted, or translated into any language, in any form or by any means, electronically or mechanical, including photocopying, recording, storage in a database or retrieval system, or otherwise, without the prior written permission of EBook Publishing. Disclaimer We take great care to ensure the accuracy of these materials; however, EBook Publishing makes no warranty, express or implies, including without limitation any warranty concerning the adequacy, accuracy or completeness of such information or material or the results to be obtained from using such information or material. EBook Publishing reserves the right to revise this publication and to make changes in its content at any time, without obligation to notify any person or entity of such revisions or changes.

Microsoft

Access 2003
HOW TO USE THIS MANUAL

Module 4

The CompleteVISUALTM step-by-step computer training manual is specially developed and organized based on the Instructional Design concepts, to ensure the effectiveness of the learning process. Most of the tasks in each chapter fit into a single page for easy reference. Most tasks are summarized to less than 10 key steps and accompanied by actual screen illustrations. Every step you go through is practical and relevant. All chapters are independent. No exercise files need to be installed prior to the training, so you can start training from the modules that best suit you or your trainees. However, the module sequence that we suggest is designed to optimize your computer learning process.

Section name. Each section groups related chapters to make sure you learn all the related features and skills in complete details.

Chapter name. Each chapter is an independent learning unit. No exercise files need to be installed prior to the training. This lets you start your training anywhere or anytime you like.

Chapter introduction.
Each chapter begins with a presentation and illustration to prepare you for the concepts you will learn.

Microsoft

Access 2003
HOW TO USE THIS MANUAL
Instructions Click File >> Save. Press <Shift>+<Tab> Type Photo from Kevin Jeff.

Module 4

You are asked to Click File to expand the file menu from the menu bar, then click the Save command from this menu. Hold down the Shift key while pressing the Tab key on the keyboard. Type the phrase Photo from Kevin Jeff.
Handy summary. Each task concludes with a summary that reinforces the key steps in the task. It also serves as a cue card for a specific task.

Task Name. Each task consists of a series of fully


illustrated step-by-step instructions, which help you through the hands-on activities.

Visual step-by-step instructions take you


through hands-on activities to accomplish each task. These instructional actions appear in bold. The important commands or keywords are highlighted in this font and style. The text that you need to type in appears in this font and styles such.

Detailed descriptions and explanations on


each step help you to learn more about the step that you have just performed.

Actual screen illustrations such as the


dialog boxes and the result outcomes are displayed to show you how they appear on screen. This helps you to learn visually and effectively. A rectangle or circle is used to draw your attention to the part of the illustration that you are dealing with.

Appropriate tips, tricks, and shortcuts that you may


find useful are included to further enhance your skills.

Microsoft

Access 2003
TABLE OF CONTENTS

Module 4

CREATING ADVANCED FORMS .................................................................... 7


Creating And Customizing Effective Forms ........................................................................... 8 How To Create A Form Using The Form Wizard.............................................................. 11 How To View A Form Design............................................................................................ 13 How to Show / Hide The Field List.................................................................................... 13 How to Show / Hide The Toolbox ..................................................................................... 13 How To Resize A Form Control ........................................................................................ 14 How To Reposition Controls And Labels .......................................................................... 15 How To Move A Control And A Label Separately............................................................. 16 How To Delete A Field Control ......................................................................................... 16 How To Add A Field Control ............................................................................................. 17 How To Control The Cursor Using The Tab Order Feature.............................................. 18 How To Change the Control Properties ............................................................................ 20 How To Change The Properties Of A Form...................................................................... 21 How To Select Multiple Controls....................................................................................... 23 How To Make The Form Header/Footer Visible ............................................................... 24 Creating Powerful And User Friendly Controls On A Form ................................................ 25 How To Create A Form From Scratch .............................................................................. 28 How To Create A Header And Footer............................................................................... 29 How To Insert A Label ...................................................................................................... 30 How To Format Text Properties........................................................................................ 31 How To Change The Background Color Of A Form ......................................................... 32 How To Apply Special Effects........................................................................................... 33 How To Change The Background Image Of A Form........................................................ 34 How To Add A Text Box Field Control .............................................................................. 35 How To Add An Unbound Text Box Control ..................................................................... 36 How To Rename A Control And Its Label......................................................................... 37 How To Insert A Function Into A Control .......................................................................... 38 How To Insert A Calculated Control.................................................................................. 39 How To Insert An Option Group Control ........................................................................... 40 How To Insert A Combo Box Control................................................................................ 43 How To Insert A List Box Control...................................................................................... 45 How To Insert Command Button....................................................................................... 47 How To Use Windows XP Themes................................................................................... 49 Integrating The Main Form And Subforms ........................................................................... 50 How To Create A Subform................................................................................................ 51 How To Create A Main Form ............................................................................................ 52 How To Integrate A Subform Into The Main Form............................................................ 53 How To Hide Record Navigation Buttons In A Subform ................................................... 55 How To Hide Field Information In A Subform ................................................................... 56 How To Change The Size Of A Subform .......................................................................... 57

CREATING ADVANCED REPORTS.............................................................. 58


Working With Report Sections............................................................................................... 59 How To Create A Report Using The Wizard..................................................................... 63 How To Reorganize Labels And Controls In Sections...................................................... 67 How To Insert A Calculated Control.................................................................................. 69 How To Change The Format Of A Control ....................................................................... 70 Customizing Report Sections ................................................................................................ 71
2003 ComputerTrainingManual.com

Microsoft

Access 2003
TABLE OF CONTENTS

Module 4

How To Create A Report From Scratch ............................................................................ 73 How To Insert Header And Footer Sections ..................................................................... 74 How To Insert Group Header And Footer Sections .......................................................... 75 How To Insert Controls And Labels Into Sections ............................................................ 76 How To Customize The Format Of A Control ................................................................... 77 How To Change The Properties Of A Group .................................................................... 78 How To Change The Properties Of A Section .................................................................. 79 How To Insert Analytical Values Into Sections ................................................................. 80 How To Insert Page Numbers........................................................................................... 81 Creating A Chart Report ......................................................................................................... 82 How To Create A Chart Report Using The Wizard ........................................................... 83 How To Select The Chart Type And Layout ..................................................................... 84

AUTOMATING A DATABASE WITH MACROS ............................................ 86


Working With Macros .............................................................................................................. 87 How To Create A Macro ................................................................................................... 88 How To Run A Macro........................................................................................................ 89 How To Edit And Rename A Macro .................................................................................. 90 How To Group Macros ...................................................................................................... 91 How To Insert A Button To Run A Macro ......................................................................... 92 How To Filter A Record Using A Macro ............................................................................ 94 How To Create A Conditional Macro ................................................................................ 96 How To Secure A Database With An Autoexec Macro..................................................... 97

2003 ComputerTrainingManual.com

Creating Advanced Forms

Objectives:

When you have completed these lessons, you will be able to:
Create a form using the wizard Show/hide field lists and the toolbox Customize form designs Insert and delete controls Change controls and form properties Add multiple control types Make a form header/footer visible Create a form from scratch Create a form header and footer Apply special effects Change the background image of a form Add a bound text box control Add an unbound text box control Create a formula in a control Create calculated controls Add an option group Add a combo box Add a list box Add a useful command button Create a main form and subform Integrate the main and subform Hide information in a subform Resize the subform

2003 ComputerTrainingManual.com

Microsoft

Access 2003
CREATING ADVANCED FORMS
Creating And Customizing Effective Forms

Module 4

A form is an interface to let you view information from tables or queries. You also use forms to enter data into tables. Forms make your database easy to use and view. You can arrange all the information in a record to be displayed on a single screen, whereas you have to scroll the screen if you read directly from the table datasheet. You are able to design your form to the way you like so you can view the data quickly and effectively. A form displays OLE object fields like photos but this data is not visible in the table datasheet view. Forms enable you to retrieve data from multiple tables or queries. You can also enter data into multiple tables. Your database users no longer need to search for the tables to view or enter the information.

Table Datasheet View. Displays records directly from table datasheet.

Form View. Displaying records in the form make your database easier to use and view.

2003 ComputerTrainingManual.com

Microsoft

Access 2003
CREATING ADVANCED FORMS

Module 4

All the information on a form or report is contained in controls. On data access pages, information is contained in controls in the same way as it is on forms and reports. However, information can also be typed directly on the data access page. You are able to change the design of the form. You can delete the existing controls, add more controls, move or resize the controls. In order to customize or change the form design, you have to open the form in design view.

Form Design View Shows you the layout of the form so you can customize it.

Show Field List button


Click to show/hide Field List.

Show Toolbox button


Click to show/hide Toolbox.

Data Source Table Name Field List


Shows all fields in data source table. Drag and drop the field to place onto form.

Toolbox
Shows tools to design your form.

Control
Object that contains data or runs actions. E.g. Field is known as control on form.

2003 ComputerTrainingManual.com

Microsoft

Access 2003
CREATING ADVANCED FORMS

Module 4

Create a new database. Then, import all the tables from the Northwind.mdb database. Depending on your setup, the Northwind database should be in the C:\Programs Files\Microsoft Office\Office11\Samples folder.

2003 ComputerTrainingManual.com

10

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Create A Form Using The Form Wizard

Module 4

1.

From the Object Bar, click the Forms button. Doubleclick Create form by using wizard.
The Form Wizard dialog box appears.

SUMMARY

1. From the Object Bar, click the Forms button. 2. Double-click Create form by using wizard. 3. In the Table/Queries box, select the table you want to use. 4. Click to set all the fields for the form. 5. Click the Next button and select form layout. 6. Click the Next button and select the form style. 7. Click the Next button and type in the form name. 8. Click the Finish button.

2.

In the Table/Queries box, click the Employees table.


The Employee table fields are displayed.

3. 4.

Click

to select all the fields for the new form.

All the fields are sent into the Selected Fields box.

Click the Next button.


A dialog box appears to determine the layout of your form.

2003 ComputerTrainingManual.com

11

Microsoft

Access 2003
CREATING ADVANCED FORMS
5. 6.
Click the Columnar option button.

Module 4

You can choose other layouts and see the layout preview on the left.

Click the Next button. Click the Industrial style.


A dialog box appears to determine the style of your form.

7.

Click the Next button. Type All Employees as the form name.
The default name is the table name: Employees.

8.

Select the Open the form to view or enter information option. Then, click the Finish button. The All Employees form is displayed.

2003 ComputerTrainingManual.com

12

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To View A Form Design

Module 4

1.

Select the All Employees form from the Database Window.


Make sure you are in the form view.

2.
SUMMARY

Click the

Design button.

The design of the form is displayed as shown below. 1. Select the form from the Database Window. 2. Click the Design button. 3. Click the Field List button to display the Field List. 4. Click the Toolbox button to display the Toolbox. .
TIPS

If the form is already open in form view, click the Design view button on the Database toolbar to switch to Design View.

How to Show / Hide The Field List

3.

Click the

Field List button to display the Field List.

This is a toggle button. Clicking the button again will hide the Field List.

How to Show / Hide The Toolbox

4.

Click the

Toolbox button to display the Toolbox.

This is a toggle button. Clicking the button again will hide the Toolbox.

2003 ComputerTrainingManual.com

13

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Resize A Form Control

Module 4

1.

Open the All Employees form in Design View. Click the Notes control.
Handles appear at the edges of the Notes control.

2.
SUMMARY

Drag the bottom Resize Handle up.


The bottom resize handle is circled below.

1. Open the form in Design View. 2. Click the control to select it. 3. Drag the resize handle. The mouse pointer changes to when it is positioned at the resize handle.

3.

Release the mouse.


The control is resized.

2003 ComputerTrainingManual.com

14

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Reposition Controls And Labels

Module 4

1.

Open the All Employees form in Design View. Click the Reports To control.
Make sure you open All Employees form in Design View.

2.

Position the mouse pointer over the border of the control.


The pointer changes to as shown below.

SUMMARY

1. Open the form in Design View. 2. Click the control. 3. Position the mouse pointer over the border of the control. 4. Drag the control to the new location. 5. Release the mouse.

3.

Drag the control up.


A thin line appears to indicate the new location of the label and the control.

4.

Release the mouse.


Both the control and the label are relocated.

2003 ComputerTrainingManual.com

15

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Move A Control And A Label Separately

Module 4

1.

Position the mouse at the upper left handle of the control.


You will move only the control, not the label. This handle determines the position of the control while the handle on the upper left of the label determines when it is positioned at the handle. the label position. The pointer changes to

SUMMARY

1. Open the form in Design View. 2. Click the control. 3. Position the mouse on the upper left handle of the control. 4. Drag the handle. 5. Release the mouse.

2.

Drag the control down to the left.


A thin line appears to indicate the new position of the control

3.

Release the mouse.


The control is relocated.

How To Delete A Field Control

1. 2.

Open the All Employees form in Design View. Click the Report To control.
You will delete the Report To control.

SUMMARY

3.

Press <Delete>.
The control is now deleted.

1. Open the form in Design View. 2. Click the control. 3. Press <Delete>.

2003 ComputerTrainingManual.com

16

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Add A Field Control

Module 4

4. 5.

From the Field List box, click the Reports To field.


Click to show the Field List if it does not appear on screen.

Drag the Reports To field from the Field List to the form.
To drag multiple fields, select the fields using the <Ctrl> key before dragging them into the form.

SUMMARY

1. From the Field List box, drag the control onto the form. 2. Release the mouse.

6.

Release the mouse.


The field is added onto the form.

2003 ComputerTrainingManual.com

17

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Control The Cursor Using The Tab Order Feature

Module 4

The tab order determines the order in which you advance from one field to the next field when you press the <Tab> key. The initial tab order is set according to the order of the creation of the fields on the form, not the position of the fields (controls). If you have rearranged the controls, you should change the tab order so it reflects the order in which the fields appear.

1.
SUMMARY

Switch the positions of the LastName and FirstName controls in the Design view as shown below.
You can switch to form view and press the <Tab> key to observe the cursor movement in the `LastName and `FirstName controls.

1. Click View >> Tab Order. 2. Click the field row selector. 3. Drag and drop the rows to rearrange the tab order. 4. Click the OK button.

2.

From the menu, click View >> Tab Order.


The design of the form is displayed as shown below.

3.

Click the LastName row selector.


The LastName row is highlighted.

2003 ComputerTrainingManual.com

18

Microsoft

Access 2003
CREATING ADVANCED FORMS
4.
TIPS

Module 4

Drag and drop the LastName row below the FirstName row.
Make sure you drag the row selector. The new order is shown below.

You can also click the Auto Order button to automatically reset the order according to the position of the new fields that appear on the form.

5.

Click the OK button.


The new tab order is set. Switch to Form View and press the <Tab> key to see if the cursor moves to the `FirstName control, then to the `LastName control.

2003 ComputerTrainingManual.com

19

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Change the Control Properties

Module 4

1.

Open the All Employees form in Design view. Click the Properties button.
The properties dialog box appears as shown below.

SUMMARY

1. Click the Properties button. 2. Click the control which you want to view the properties of.

TIPS

2.

Click the EmployeeID control.


The properties dialog box is updated to show the related properties.

You can also doubleclick the control to open the related properties dialog box.

Tabs Format Data Event Other All

Description Determines the appearance of the control on the form. Determines data source, default value and validation rules. Sets actions by assigning macros or visual basic procedures to the control. Like determines controls name, whether tabbing into control is allowed, message on status bar etc. Displays all the properties of the control.

2003 ComputerTrainingManual.com

20

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Change The Properties Of A Form

Module 4

1.

Select the All Employees form from the Database Window. Click the Design button.
The All Employees form opens in Design View.

2.
SUMMARY

Open the Properties dialog box.


Click the properties button on the toolbar.

3.

1. Open the form in Design View. 2. Click the Design button. 3. Open the Properties dialog box. 4. In the Properties dialog box, click the object down-arrow and click Form. 5. Change the properties settings in the dialog box.

In the Properties dialog box, click the object downarrow and click Form.
The form properties appear in the Form dialog box.

4. 5.

In the Caption box, type All Employees.


The form title displays All Employees instead of Employees.

In the Default View box, click Continuous Forms.


The form is set to Continuous Forms as the default form display style.

2003 ComputerTrainingManual.com

21

Microsoft

Access 2003
CREATING ADVANCED FORMS
6.
Switch to the Form View.

Module 4

Note that the title of the form has changed and the forms appear continuously, as shown below

2003 ComputerTrainingManual.com

22

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Select Multiple Controls

Module 4

1.

Open the All Employees form in Design View. Click and drag the mouse pointer over the Country, HomePhone and Extension controls.
A thin outline appears while you drag the mouse. All controls falls within the outline are selected automatically. Important: Please drag from the blank area of the form, or else you may end up selecting only the object where you click.

SUMMARY

1. Open the form in Design view. 2. Click and drag the mouse pointer to draw an outline over the controls you want to select.

The controls are selected as shown below.

TIPS

You can also hold the <Shift> key and click the controls to select multiple controls. You can change the control properties simultaneously if you select multiple controls.

2.

Click the EmployeeID control.


You will select two non-adjacent controls. The EmployeeID control is selected, as shown below.

3.

Hold down <Shift>, and then click the LastName control.


Both controls are selected as shown below.

2003 ComputerTrainingManual.com

23

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Make The Form Header/Footer Visible

Module 4

1.

Open the All Employees form in Design View. Position the mouse pointer over the borderline below the Form Header bar.
The pointer changes to a double-headed arrow, as shown below.

SUMMARY

1. Open the form in Design View. 2. Drag the borderline below the Form Header bar down to set the height for the Form Header. 3. Type in text or create a control in the Form Header section.

2.

Drag down to set the height of the header.


The Form Header section appears.

.
TIPS

You can also type in text into the Header section using the label tool or change the header section background color. Use the same technique for your Form Footer.

3.

Drag and Drop the EmployeeID control onto the Form Header area.
The EmployeeID appears on the form header.

4.

Switch to the Form view.


The form appears with the header as shown below.

2003 ComputerTrainingManual.com

24

Microsoft

Access 2003
CREATING ADVANCED FORMS

Module 4

Creating Powerful And User Friendly Controls On A Form


You can move, resize, or set the format properties of a control. You can also add controls to display calculated values, totals, the current date and time, and other useful information on a form. Controls are objects on a form, report, or data access page that display data, perform actions, or are used for decoration. For example, you can use a text box on a form, report, or data access page to display data, a command button on a form to open another form or report; or a line or rectangle to separate and group controls to make them more readable. You should create a user-friendly form to help or assist your users in entering data. Access 2003 provides a set of handy tools for you to accomplish this. You can also control the appearance of the data displayed on the form with the tools. The following is a list of the tools in the toolbox that can help you to customize your form.
Tools Select Objects Control Wizards Description Selects a control, section, form, report, or data access page. Click this tool to unlock a toolbox button that you've locked down. Turns control wizards on or off. Use control wizards to help you create a control, such as a list box or command button. In a form, additional wizards are available for a combo box, option group, subreport, and subform. And in a data access page, you can use a wizard to create a drop-down list box or a Microsoft Office chart. To use wizards to create a control, the Control Wizards button must be pressed in. You cannot use wizards in a stand-alone page, and you cannot use them when you point a page to a database other than the database currently open. Displays descriptive text, such as a title, a caption, or instructions on a form, report, or data access page. Labels on forms and reports can contain hyperlinks, but hyperlinks in a report won't work when viewed in Microsoft Access; hyperlinks will work when you output the report to Microsoft Word, Microsoft Excel, or to HTML format. Access automatically attaches labels to the controls you create. Used to display, enter, or edit data in the underlying record source of a form, report, or data access page, display the results of a calculation, or accept input from a user.

Label

Text Box

2003 ComputerTrainingManual.com

25

Microsoft

Access 2003
CREATING ADVANCED FORMS
Tools Option Group Description

Module 4

Used along with check boxes, option buttons, or toggle buttons to display a set of alternative values. For example, you can use an option group to specify whether an order is shipped by air, sea, or land. In a data access page, an option group can contain only option buttons. Used as a stand-alone control bound to a Yes/No field in a Microsoft Access database or a Bit column in a Microsoft Access project. The toggle button is an unbound control for accepting user input in a custom dialog box or in part of an option group. Used as a stand-alone control bound to a Yes/No field in a Microsoft Access database or a Bit column in a Microsoft Access project. The option button is an unbound control for accepting user input in a custom dialog box or in part of an option group. Used as a stand-alone control bound to a Yes/No field in a Microsoft Access database or a Bit column in a Microsoft Access project. The check box is an unbound control for accepting user input in a custom dialog box or in part of an option group. Combines the features of a list box and a text box. You can type in the text box or select an entry in the list box to add a value to an underlying field. Displays a scrollable list of values. When a form is open in Form view or when a data access page is open in Page view or Microsoft Internet Explorer, you can select from the list to enter a value into a new record or to change the value in an existing record. Used to perform actions, such as finding a record, printing a record, or applying a form filter. Used for displaying a static picture on a form or report. Because a static picture is not an OLE object, you can't edit the image inside Microsoft Access after you've added it to a form or report. Used to display an unbound OLE object, such as a Microsoft Excel spreadsheet, on a form or report. The object remains constant as you move from record to record. Used to display OLE objects, such as a series of pictures, on a form or report. This control is for objects stored in a field in the form's or report's underlying record source. A different object appears on the form or report as you move from record to record. Used to begin a new screen on a form, a new page on a printed form, or a new page of a report.

Toggle Button

Option Button

Check Box

Combo Box

List Box

Command Button Image

Unbound Object Frame Bound Object Frame

Page Break

2003 ComputerTrainingManual.com

26

Microsoft

Access 2003
CREATING ADVANCED FORMS
Tools Tab Control Description

Module 4

Used to create a tabbed form with several pages (such as the employee form in Northwind) or tabbed dialog box (such as the Options dialog box on the Tools menu). You can copy or add other controls onto a tab control. Right-click on the Tab control in the design grid to modify the number of pages, the page order, the selected page's properties, and the selected tab control properties. Used to display data from more than one table on a form or report. Used on a form, report, or data access page to emphasize related or especially important information or to divide a form or page into different sections, for example. Used for graphic effects, such as grouping a set of related controls, or used for emphasizing important data on a form, report, or data access page. Displays other toolboxes and OLE objects.

Subform/Subreport Line

Rectangle

More Controls

2003 ComputerTrainingManual.com

27

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Create A Form From Scratch

Module 4

1.

From the Object bar, click Forms. Click the New button.
The New Form dialog box appears.

2.
SUMMARY

In the list box, click Design View. In the drop-down box, click the Employees table.
This specifies that the record source for the form comes from the Employees table.

1. Click the New form button. 2. In the New Form dialog box, click Design View. 3. Select the record source. 4. Click the OK button.

TIPS

If you have forgotten to select the record source. You can specify the source in Form Properties. (In the Data tab, specify the source in the record source box.)

3.

Click the OK button.


A blank form is created as shown below.

4.

Save the form as New Employee.

.
2003 ComputerTrainingManual.com

28

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Create A Header And Footer

Module 4

1.

Open the New Employee form in Design View.


The initial blank form does not have the header / footer section.

SUMMARY

1. Open the form in Design View. 2. Click View >> Form Header/Footer.

2.

From the menu, click View >> Form Header/Footer.


The form header and footer sections are created, as shown below.

2003 ComputerTrainingManual.com

29

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert A Label

Module 4

1.

Open the New Employee form in Design View. Click the Label button on the toolbox.
This enables you to place text or labels on your form.

2.
SUMMARY

Click in the header section.


The label insertion cursor is placed in the header.

1. Open the form in Design View. 2. Click the Label button on the toolbox. 3. Click where you want to place the text. 4. Type the text.

TIPS

If the toolbox is not visible, click the Toolbox button on the toolbar.

3.

Type Employee Form.


You will be changing the text format later.

4.

Switch to the Form View.


The text appears in the form header section.

2003 ComputerTrainingManual.com

30

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Format Text Properties

Module 4

1.

Open the New Employee form in Design View. In the Form Header, click the Employee Form label.
The label is selected

SUMMARY

1. Open the form in Design View. 2. Select the object. 3. Click the Properties button on the toolbar. 4. Click the Format tab. 5. Change the properties settings.

2.

Click the

Properties button on the toolbar.

The Label properties dialog box appears as shown below.

TIPS

You can double-click any object on the form to open its properties dialog box. If you want to enlarge the label object on the form, drag the resize handles around the object, or double-click any resize handle around the object to auto fit the object.

3.

Click the Format tab. Scroll down and change the Fore Color, Font Name and Font Size, as shown below.
The fore color is the text color, represented by a code. Click the fore color box, then click to select the color. Select blue to see the following color code.

4.

Enlarge the Header section. Then enlarge the label object.


You have to enlarge it to see the entire label.

2003 ComputerTrainingManual.com

31

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Change The Background Color Of A Form

Module 4

1.

Open the New Employee form in Design View. Double-click the header background.
The Form Header properties dialog box appears.

SUMMARY

1. Open the form in Design View. 2. Double-click the header background. 3. Click the Format tab. 4. In the Back Color box, change the settings. 5. Click the OK button.

2.

Click the Format tab. In the Back Color box, click and then select yellow as the color for the background.
The Color palette dialog box appears for you to select the color.

3.

Click the OK button.


The code for yellow appears in the Back Color box.

. The header background color changes to yellow.

2003 ComputerTrainingManual.com

32

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Apply Special Effects

Module 4

1.

Open the New Employee form in Design View. In the Form Header, double-click the Employee Form label.
The Label properties dialog box appears.

2.
SUMMARY

Click the Format tab. Click the Special Effect dropdown arrow, and then select Raised.
The effect is applied to the selected label immediately.

1. Open the form in Design View. 2. Double-click the object. 3. Click the Format tab. 4. In the Special Effect box, select the option you want.

TIPS

There are six special effects in Access 2003. Flat Raised Sunken Etched Shadowed Chiseled.

Click

on the toolbar to see the form in Form View.

2003 ComputerTrainingManual.com

33

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Change The Background Image Of A Form

Module 4

1.

Open the New Employee form in Design View. Open the Form properties.
In the Form properties dialog box, click the drop-down arrow and select Form from the list, as shown below.

SUMMARY

1. Open the form in Design View. 2. Open the Form properties. 3. Click the Format tab. 4. In the Picture box, select the new image. 5. In the Picture Tiling box, click Yes.

2.

Click the Format tab. In the Picture box, locate the file Santa Fe Stucco.bmp. Click the Picture Tiling dropdown arrow, then select Yes.
The Santa Fe Stucco.bmp image is found in the Windows folder. You will tile the small image to fill the entire form background.

The form appears as below in form view. Delete the image from the Picture box to remove the background picture before you continue.

2003 ComputerTrainingManual.com

34

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Add A Text Box Field Control

Module 4

1.

Open the New Employee form in Design View. Drag the BirthDate field onto the form Detail section.
If you do not see the field list, click the Field list button on the toolbar.

SUMMARY

1. Open the form in Design View. 2. Drag the field from the filed list to the form design.

2.

Switch to Form View to see the control.


The form now shows the following data.

2003 ComputerTrainingManual.com

35

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Add An Unbound Text Box Control

Module 4

1.

Open the New Employee form in Design View. Click Text Box button in the toolbox. the
Make sure the Text Box button is highlighted.

2.
SUMMARY

Move the mouse below the BirthDate control in the Detail section and click once.
The unbound text box is created as shown below. This control does not retrieve from or enter data to any table.

1. Open the form in Design View. 2. Click the Text Box button in the toolbox. 3. Click the position where you want to place the unbound text box.

TIPS

The label may vary from what you see on your screen. It is just a default name that you can change later.

3.

Switch to Form View to see the control.


The form shows the following data.

2003 ComputerTrainingManual.com

36

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Rename A Control And Its Label

Module 4

1.

Open the New Employee form in Design View. Double-click the Unbound text box control.
The Text Box properties dialog box appears.

SUMMARY

2.

Click the All tab.


All the text box properties are displayed in the dialog box.

1. Open the form in design view. 2. Open the properties dialog box for the control. 3. Click the All tab. 4. In the Name box, type the new name. 5. Double-click the label text. In the Caption box, type the new label text.

3.

In the Name box, type CurrentDate.


The control name changes.

4.

Double-click the label text. From the Properties dialog box, in the Caption box, type Current Date:.
This is to change the label for the text box.

5.

Switch to Form View to see the control.


If you do not see the entire label, enlarge the label object in design view.

2003 ComputerTrainingManual.com

37

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert A Function Into A Control

Module 4

1.

Open the New Employees form in Design View. Click the CurrentDate control to select it.
Make sure you click the text box, not the label.

SUMMARY

2.

Type =Now(). Then, press <Enter>.


This formula displays the computer current date and time.

1. Open the form in Design View. 2. Click the control. 3. Type in the formula.

Open the CurrentDate control properties box; the formula automatically appears in the Control Source box.
TIPS

In the Format box, select the Short Date format, as shown below.

You can also create a formula for the control by typing the formula directly into the Control Source box.

3.

Switch to Form View to see the control.


The form shows the following data. Your Current Date will be different from the one shown below.

2003 ComputerTrainingManual.com

38

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert A Calculated Control

Module 4

1.

Open the New Employee form in Design View. Click Text Box button on the toolbox. the
Make sure the Text Box button is locked.

SUMMARY

1. Open the form in Design View. 2. Click the Text Box button on the toolbox. 3. Click the position you want to place the control. 4. Type in the formula. 5. Press <Enter>.

2.

Click below the CurrentDate control.


A new unbound text box is created as shown below.

3.

Type =([CurrentDate]-[BirthDate])/365 and press <Enter>.


The square brackets certain field/control names. This formula will find the difference in days between the birth date and the current date. This formula is then divided by 365 days to get the age of the employee.

The form appears as shown below in the form view.

4.

Change the format and label for the control as shown below.
Tip: Format: Standard, Decimal Places: 0

2003 ComputerTrainingManual.com

39

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert An Option Group Control

Module 4

1.

Open the New Employees form in Design View. Click the Option Group button on the toolbox.
This enables you to create a control that provides options for users to select on your form.

2.
SUMMARY

Drag the Country field from the field list onto the form.
The Option Group Wizard dialog box appears.

1. Open the form in Design View. 2. Click the Option Group button on the toolbox. 3. Drag the field from the field list onto the form. 4. Type in the label names. 5. Click the Next button and select default value. 6. Click the Next button and change the option values. 7. Click the Next button and select the data destination. 8. Click the Next button and select the type and style of the option control. 9. Click the Next button, change the label and click the Finish button.

3.

Under Label Names, type USA, UK and Canada.


This is where you specify the list of countries in the option group control.

TIPS

Make sure the Control Wizards button on the toolbox is highlighted; otherwise the option group tool will not lead you to the wizard steps shown in this task.

4.

Click the Next button. Click the No, I dont want a default option button.
Choose the default value from the list if you want the value to be set to the country field every time you create a new record using this form.

2003 ComputerTrainingManual.com

40

Microsoft

Access 2003
CREATING ADVANCED FORMS
5.
Click the Next button.

Module 4

The country names are represented by numbers, as shown below. Change the values if necessary.

6.

Click the Next button.


The values entered by users will be kept in the Country field in the table.

7.

Click the Next button.


You can select the type and style of the control here.

2003 ComputerTrainingManual.com

41

Microsoft

Access 2003
CREATING ADVANCED FORMS
8.

Module 4

Click the Next button. Click the Finish button.


The final step is to confirm the label that appears for the option group.

TIPS

You can reposition or format the option group elements in the form design view. You can also change the values by changing the radio button properties.

The option group appears in the Form Design View, as shown below.

The option group appears in the Form View, as shown below.

2003 ComputerTrainingManual.com

42

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert A Combo Box Control

Module 4

1.

Open the New Employees form in Design View. Click the Combo Box button in the toolbox.
You will create a drop-down list box on your form. Make sure the Control Wizards button on the toolbox is highlighted.

2.
SUMMARY

Drag the Country field from the field list onto the form.
The Combo Box Wizard appears.

1. Open the form in Design View. 2. Click the Combo Box button on the toolbox. 3. Drag the field from the field list onto the form. 4. Select where to get the values from. 5. Follow the instructions in the combo Box Wizard and click the Next buttons to go through the process. 6. Click the Finish button.

3.

Click the I will type in the values that I want option button.
The first and the third options are self-explanatory.

TIPS

The wizard dialog boxes may vary when you select different options in the wizards.

4.

Click the Next button and type USA, UK and Canada as shown below.
Press the <Down-Arrow> key to move to the next row.

2003 ComputerTrainingManual.com

43

Microsoft

Access 2003
CREATING ADVANCED FORMS
5.
Click the Next button.

Module 4

Here is where you specify the location you want to store the value.

6.

Click the Next button.


Type Country as the label name if necessary.

7.

Click the Finish button.


The control appears in the form design view as shown below.

The combo box appears as shown below in the form view.

2003 ComputerTrainingManual.com

44

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert A List Box Control

Module 4

1.

Open the New Employees form in Design View. Click the List Box button in the toolbox.
You will create a list box on your form. Make sure the Control Wizards button on the toolbox is highlighted.

SUMMARY

2.

Drag the Country field from the field list onto the form.
The List Box Wizard appears.

1. Open the form in Design View. 2. Click the List Box button in the toolbox. 3. Drag the field from the field list onto the form. 4. Select where to get the values. 5. Follow the instructions in the List Box Wizard and click the Next buttons to proceed through the steps. 6. Click the Finish button.

3.

Click the I will type in the values that I want option button.
The first and the third options are self-explanatory.

TIPS

The wizard dialog boxes may vary when you select different options in the wizards.

4.

Click the Next button and type USA, UK and Canada as shown below.
Press the <Down-Arrow> key to move to the next row.

2003 ComputerTrainingManual.com

45

Microsoft

Access 2003
CREATING ADVANCED FORMS
5.
Click the Next button.
This is where you specify where you want to store the value.

Module 4

6.

Click the Next button.


Type Country as the label name if necessary.

7.

Click the Finish button.


The control appears in the form design view and the form view as shown below. You can resize the list box to save space on the form. If the option list exceeds the size of the box, scroll bars appear automatically to let you scroll through the list.

2003 ComputerTrainingManual.com

46

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Insert Command Button

Module 4

1.

Open the New Employees form in Design View. Click the Command Button in the toolbox.
You will create a command button on your form. Make sure the Control Wizards button in the toolbox is highlighted.

2.
SUMMARY

Click on the form where you want to place the command button.
The Command Button Wizard appears.

1. Open the form in Design View. 2. Click the Command Button in the toolbox. 3. Click where you want to place the command button. 4. Select the Categories and Actions for the button. 5. Click the Next button and select the buttons appearance. 6. Click the Next button and name the button. 7. Click the Finish button.

3.

In the Actions box, click Go To Last Record.


These are the Access 2003 built-in command buttons that enables you to carry out simple actions.

4.

Click the Next button.


This is where you can specify the appearance of the button.

2003 ComputerTrainingManual.com

47

Microsoft

Access 2003
CREATING ADVANCED FORMS
5.
Click the Next button. In the text box, type LastRecord.
A meaningful name will help you to refer to the button later.

Module 4

6.

Click the Finish button.


The command button appears in the form view as shown below. You can resize the command button in design view to save space on the form.

When you click the button, the last record appears

2003 ComputerTrainingManual.com

48

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Use Windows XP Themes

Module 4

1. 2.

From the menu, click Tools >> Options.


The Options dialog box appears.

Click the Forms/Reports tab. Select the Use Windows Themed Controls on Forms check box.
Access applies the selected Windows Theme to views, dialog boxes and controls.

SUMMARY

1. Click Tools >> Options. 2. Click the Forms/Reports tab. 3. Select the Use Windows Themed Controls on Forms check box. 4. Click the OK button.

3.

Click the OK button.


The dialog box closes.

2003 ComputerTrainingManual.com

49

Microsoft

Access 2003
CREATING ADVANCED FORMS
Integrating The Main Form And Subforms

Module 4

When a form is inserted in another form, the primary form is called the main form, and the form within the form is called the subform. A form/subform combination is also called a hierarchical form, a master/detail form, or a parent/child form. Subforms are especially effective when you want to show data from tables or queries with a one-to-many relationship. For example, you could create a form with a subform to show data from the Orders table and the Order Details table. The data in the Orders table is the "one" side of the relationship. The data in the Order Details table is the "many" side of the relationship each order can have multiple order details. Form View
Orders Form (main form) The one side of the relationship.

Order Details Form (subform) The many side of the relationship. Contains multiple records.

Design View

2003 ComputerTrainingManual.com

50

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Create A Subform

Module 4

1.

From the Database Window, double-click Create form by using wizard.


The Form Wizard dialog box appears.

2.
SUMMARY

Select all fields from the Table: Order Details as shown below.

1. Double-click Create form by using wizard in the database window. 2. Select fields from the tables to be shown in the subform. 3. Click Next and select the subform layout. 4. Continue to click the Next button until you reach the end of the wizard.

TIPS

3.

Click the Next button and click the Datasheet layout.


The subform will be displayed in datasheet format.

Normally the subform is displayed in the Datasheet Layout; however, you can also select other layouts.

4.

Click the Next button twice and click the Finish button. Then close the form.
The subform is now created. It is just an ordinary form before you integrate it into the main form.

2003 ComputerTrainingManual.com

51

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Create A Main Form

Module 4

1.

In the Database Window, double-click Create form by using wizard.


The Form Wizard dialog box appears.

2.
SUMMARY

Select OrderID and OrderDate from Table: Order as shown below.


You are going to create a simple order form with only this information.

1. Double-click Create form by using wizard in the database window. 2. Select fields from the tables to be shown in the main form. 3. Click the Next button and select the main form layout. 4. Click the Next button and select the main form style. 5. Continue until the end of the wizard.

3.

Click the Next button and select the Columnar layout. Click the Next button and select the Industrial style.
You can select another layout or style if you want.

4.

Click the Finish button.


The main form is created with the default name Orders. It is just an ordinary form before you integrate it to with the subform. You need to enlarge the form to accommodate the subform. Resize the main form in design view by dragging the form border on the right and the border above the Form Footer bar.

2003 ComputerTrainingManual.com

52

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Integrate A Subform Into The Main Form

Module 4

1.

Open the Orders form (the main form) in Design View. Subform/Subreport button on the Click the toolbox.
You want to insert a subform into your main form.

2.
SUMMARY

Click below the Order Date control.


The Subform Wizard dialog box appears.

1. Open form in Design View. 2. Click the Subform/Subreport button in the toolbox. 3. Click the position on the form where you want to place the subform. 4. Click the Use an existing form option button and select the subform you want. 5. Click the Next button to go through the remaining steps. 6. Click the Finish button.

3.

Click the Use an existing form option button and click the Order Details form from the list. Then click the Next button.
Select the first option if you have not created the subform.

TIPS

The integrated subform may not look perfect when you first integrate it to the main form. Most of the time you have to adjust and make modifications to the subform manually.

4.

Click the Next button.

2003 ComputerTrainingManual.com

53

Microsoft

Access 2003
CREATING ADVANCED FORMS
5.

Module 4

Click the Next button. Then click the Finish button.


The subform is integrated into the main form as shown below.

Click the Form View to see how it is displayed. You will notice that there are a few things in the subform that need to be improved. 1. The subform area is too small to display the entire subform details. 2. Confusing record navigation buttons, as there are two sets of record navigation buttons, one for the subform and one for the main form. 3. Redundant OrderID information in subform as the main form already shows the OrderID.

2003 ComputerTrainingManual.com

54

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Hide Record Navigation Buttons In A Subform

Module 4

1.

Open the Order Details form (the subform) in Design View. Show the Form properties dialog box.
You can also double-click the form selector button on the upper left corner of the form window to show the Form properties dialog box.

SUMMARY

1. Open the subform in Design View. 2. Show the form properties. 3. In the Navigation Buttons box, select No. 4. Click the Save button.

2.

In the Navigation Buttons box, select No.


The navigation buttons will be hidden when you display the form in Form View.

3.

Click the Save button. Then, click the Datasheet button to see the effects.
The record navigator buttons are hidden.

With navigation buttons

Without navigation buttons

2003 ComputerTrainingManual.com

55

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Hide Field Information In A Subform

Module 4

1.

Open the Order Details form (the subform) in Datasheet View.


Just double-click the form, as the default view for the form is datasheet. The datasheet appears, as shown below.

SUMMARY

1. Open the subform in Datasheet View. 2. Right-click the column heading of the field you want to hide. 3. Click Hide Columns from the shortcut menu. 4. Click the Save button.

2.

Right-click the Order ID column heading.


The shortcut menu appears, as shown below.

TIPS

You can also use the datasheet view to change column width so that the subform columns fit in the main form.

3.

Click Hide Columns from the shortcut menu.


The Order ID column is hidden.

4.

Click the Save button.


The new structure of the subform is saved.

2003 ComputerTrainingManual.com

56

Microsoft

Access 2003
CREATING ADVANCED FORMS
How To Change The Size Of A Subform

Module 4

1.

Open the Orders form (the main form) in Design View. Click the subform object.
Resize handles appear around the subform object.

2.
SUMMARY

Drag the resize handle circled below to the right to enlarge the width of the subform.
The pointer changes to a double-headed arrow when it is placed on the resize handle.

1. Open the main form in Design View. 2. Click the subform object. 3. Drag the resize handles to adjust the subform object size. 4. Click the Save button.

3.

Switch to the Form View to see if the subform shows all the details in full.
You may have to try adjusting the width a couple of times.

4.

Click the Save button.


The form is saved.

2003 ComputerTrainingManual.com

57

Creating Advanced Reports

Objectives:

When you have completed these lessons, you will be able to:
Create reports using the wizard Adjust labels and controls in sections Add calculated controls Format controls Create a report from scratch Create header and footer sections in a report Create group header and footer sections Add controls and labels into sections Change group properties Change section properties Add analytical values to sections Add page numbers Create a chart report Select the chart type and layout

2003 ComputerTrainingManual.com

58

Microsoft

Access 2003
CREATING ADVANCED REPORTS
Working With Report Sections

Module 4

A Report is one of the types of output of your database. Although you can print the records directly from a table, a query or a form, reports are used to produce a more flexible and professional hard copy output. You are able to control what should be displayed in the report header/footer, page header/footer, group header/footer and the details of the report.
Report Header Page Header Group Header

Detail

Page Footer

Report Footer

2003 ComputerTrainingManual.com

59

Microsoft

Access 2003
CREATING ADVANCED REPORTS
Sections Report Header Report Footer Description

Module 4

Labels/controls in this section appear only at the beginning of the report. (Top of the first page of the report). E.g. Title of the report. Labels/controls in this section appear only at the beginning of the report. (Right after the last record in the report). Normally this is used to summarize the report data. E.g. Grand Total of the Numeric Data. Labels/controls in this section appear at the top of each page of the report. E.g. Record Column Headings. Labels/controls in this section appear at the bottom of each page of the report. E.g. Page numbering. Used to display Labels/controls to indicate the group name at the beginning of each group of records. Used to display Labels/controls that summarize the group numeric data at the end of each group of records. E.g. Total for each group. Used to display the actual data for each individual record.

Page Header Page Footer Group Header Group Footer Details

The following useful tool, found in the toolbox in the report Design View, allow for you to add controls into the sections and change the appearance of your reports.
Tools Select Objects Control Wizards Description To select a control, section, form, report, or data access page. Click this tool to unlock a toolbox button that you've locked down. Turns control wizards on or off. Use control wizards to help you create a control, such as a list box or command button. In a form, additional wizards are available for a combo box, option group, subreport, and subform. And in a data access page, you can use a wizard to create a drop-down list box or a Microsoft Office chart. To use wizards to create a control, the Control Wizards button must be pressed in. You cannot use any wizards in a stand-alone page, and you cannot use them when you point a page to a database other than the database currently open. A control that displays descriptive text, such as a title, a caption, or instructions on a form, report, or data access page. Labels on forms and reports can contain hyperlinks, but hyperlinks in a report won't work when viewed in Microsoft Access; hyperlinks will work when you output the report to Microsoft Word, Microsoft Excel, or to HTML format. Access automatically attaches labels to the controls you create. Used to display, enter, or edit data in the underlying record source of a form, report, or data access page, display the results of a calculation, or accept input from a user.

Label

Text Box

2003 ComputerTrainingManual.com

60

Microsoft

Access 2003
CREATING ADVANCED REPORTS
Tools Option Group Description

Module 4

Used along with check boxes, option buttons, or toggle buttons to display a set of alternative values. For example, you can use an option group to specify whether an order is shipped by air, sea, or land. In a data access page, an option group can contain only option buttons. Used as a stand-alone control bound to a Yes/No field in a Microsoft Access database or a Bit column in a Microsoft Access project. The toggle button is an unbound control for accepting user input in a custom dialog box or in part of an option group. Used as a stand-alone control bound to a Yes/No field in a Microsoft Access database or a Bit column in a Microsoft Access project. The option button is an unbound control for accepting user input in a custom dialog box or in part of an option group. Used as a stand-alone control bound to a Yes/No field in a Microsoft Access database or a Bit column in a Microsoft Access project. The check box is an unbound control for accepting user input in a custom dialog box or in part of an option group. Combines the features of a list box and a text box. You can type in the text box or select an entry in the list box to add a value to an underlying field. Displays a scrollable list of values. When a form is open in Form view or when a data access page is open in Page view or Microsoft Internet Explorer, you can select from the list to enter a value into a new record or to change the value in an existing record. Used to perform actions, such as finding a record, printing a record, or applying a form filter. Used for displaying a static picture on a form or report. Because a static picture is not an OLE object, you can't edit the image inside Microsoft Access after you've added it to a form or report. Used to display an unbound OLE object, such as a Microsoft Excel spreadsheet, on a form or report. The object remains constant as you move from record to record. Used to display OLE objects, such as a series of pictures, on a form or report. This control is for objects stored in a field in the form's or report's underlying record source. A different object appears on the form or report as you move from record to record. Used to begin a new screen on a form, a new page on a printed form, or a new page of a report.

Toggle Button

Option Button

Check Box

Combo Box

List Box

Command Button Image

Unbound Object Frame Bound Object Frame

Page Break

2003 ComputerTrainingManual.com

61

Microsoft

Access 2003
CREATING ADVANCED REPORTS
Tools Tab Control Description

Module 4

Used to create a tabbed form with several pages (such as the employee form in Northwind) or tabbed dialog box (such as the Options dialog box on the Tools menu). You can copy or add other controls onto a tab control. Right-click on the Tab control in the design grid to modify the number of pages, the page order, the selected page's properties, and the selected tab control properties. Used to display data from more than one table on a form or report. Used on a form, report, or data access page to emphasize related or especially important information or to divide a form or page into different sections, for example. Used for graphic effects, such as grouping a set of related controls, or used for emphasizing important data on a form, report, or data access page. Displays other toolboxes and OLE objects.

Subform/Subreport Line

Rectangle

More Controls

2003 ComputerTrainingManual.com

62

Microsoft

Access 2003
CREATING ADVANCED REPORTS

Module 4

Open the previous Training2.mdb database or create a new database. If you create a new database, import all tables from the Northwind database. (Depending on your setup, the Northwind database should be found in C:\Programs Files\Microsoft Office\Office11\Samples folder).

How To Create A Report Using The Wizard

1.

From the Object Bar, click Reports. Click the New button. Click the Report Wizard. Then select Order Details as the record source.
The New Report dialog box appears as shown below.

SUMMARY

1. Click . 2. Click Report Wizard and select the record source. 3. Click the OK button and select the fields to be included in the report. 4. Click the Next button and select the grouping levels. 5. Click the Next button and specify the sort order. 6. Click the Summary Options button and specify the summary options. 7. Click the OK button and specify the report layout. 8. Click the Next button and specify the style. 9. Click the Next button and type the report name. 10. Click the Finish button.

2.

Click the OK button. Click the

button.

All the fields are selected; they will all be shown in the report.

2003 ComputerTrainingManual.com

63

Microsoft

Access 2003
CREATING ADVANCED REPORTS
3.
Click the Next button.

Module 4

You can specify how to group the records here. By default, the report is grouped by the OrderID and the details of the report are as shown below. If you want to create another grouping level, select the field name, then click the button.

4.

Click the Next button. Specify sorting records by ProductID as below.


If you want to sort the product IDs in ascending order, click the Ascending button.

2003 ComputerTrainingManual.com

64

Microsoft

Access 2003
CREATING ADVANCED REPORTS
5.

Module 4

Click the Summary Options button. In the Quantity box, click the Sum check box.
This is where you specify the summary of the report that appears at the footer of the sections. There are four functions listed here. However, you can create your own function in the report design view.

6.

Click the OK button. Then click the Next button.


You can specify different layouts for your report here.

2003 ComputerTrainingManual.com

65

Microsoft

Access 2003
CREATING ADVANCED REPORTS
7.
Click the Next button.
This is where you select the style you want to use for your report.

Module 4

TIPS

8.

Click the Next button. Then click the Finish button.


Type in the report name if you wish to use a different name from the one shown in the dialog box, or else the table name `Order Details is used as the default name for the report. The report is displayed as shown below.

You normally have to make some minor adjustments to the appearance of the report after it is created. E.g. The OrderID may appear aligned with the Order ID heading as the ID is aligned to the right of the text box.

2003 ComputerTrainingManual.com

66

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Reorganize Labels And Controls In Sections

Module 4

1.

Click the Design view button to switch the Order Details report to Design View.
The report design appears, as shown below.

SUMMARY

1. Open the report in Design View. 2. Adjust the labels and controls in the report sections. 3. Click the Print Preview button.

2.

Adjust the labels in the Page Header section, the OrderID control in the OrderID Header section, controls in the Details section and the OrderID Footer sections.
Resizing and moving the labels and control techniques in report view is similar the process in form design view. Refer to the Creating Advanced Forms section if you have difficulties resizing and moving the controls.

2003 ComputerTrainingManual.com

67

Microsoft

Access 2003
CREATING ADVANCED REPORTS

Module 4

3.

Click the Print preview button Details report.

to preview the Order

The new appearance of the report is shown below.

2003 ComputerTrainingManual.com

68

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Insert A Calculated Control

Module 4

1.

Open the Order Details report in Design View.


Make sure there is sufficient space on the right of the Discount control.

SUMMARY

1. Open the report in Design View. 2. Click the Text Box tool. 3. Click the position where you want to place the control. 4. Type the formula.

2. 3.

Click the

Text Box tool in the toolbox.

If you do not see the toolbox, click the toolbox button on the toolbar.

Click to the right of the Discount control.


A text box control is created to the right of the Discount control.

4. 5.

Type =[UnitPrice]*[Quantity]*(1-[Discount]).
The formula is entered into the control.

Delete the existing label and use the Label tool to create a new label Total on the Page Header section.
The default label for the control is no longer needed in the Details section.

The new calculated control in the report appears as shown below if you switch to Print Preview.

2003 ComputerTrainingManual.com

69

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Change The Format Of A Control

Module 4

1.

Open the Order Details form in Design View. Doubleclick the Total control.
The Text Box properties dialog box appears. The title of your text box dialog box may vary from the one shown here. Make sure the Format or All tab is selected.

SUMMARY

1. Open the report in Design View. 2. Double-click the control. 3. Click the Format tab. 4. In the Format box, select the format type.

2.

In the Format box, select Currency.


You will change the format of the Total control to currency.

3.

Switch the report to Print Preview.


The Total value appears as shown below

2003 ComputerTrainingManual.com

70

Microsoft

Access 2003
CREATING ADVANCED REPORTS
Customizing Report Sections

Module 4

You can use sections to produce calculations, group data, summarize and produce an analysis of the data in your database. You can group data to better organize the data in your report. This helps you to organize related data for analysis. For example, you may want to group total sales by each sales person so that you can compare their performance. Here is an example of a report without grouping sections.

2003 ComputerTrainingManual.com

71

Microsoft

Access 2003
CREATING ADVANCED REPORTS
An example of a report with grouping sections.

Module 4

Grouped By Ship Country Grouped By Order Date

2003 ComputerTrainingManual.com

72

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Create A Report From Scratch

Module 4

1.

From the Database Window, click Reports. Click the New button.
The New Report dialog box appears.

2.
SUMMARY

Click Design View and select the Orders table as the objects data source.
The report will get data from the Orders table.

1. Click the Reports button from the Database Window. 2. Click the New button. 3. In the New Report dialog box, select Design View and select the record source. 4. Click the OK button. 5. Save the report.

3.

Click the OK button.


The report is created and appears in Design View. By default, there are only three sections in the report: Page Header, Detail and Page Footer. There are no controls in the report. You have to add the controls manually from the field list and the toolbox.

4.

Save the report as Orders.


The default name of the report is Report1

2003 ComputerTrainingManual.com

73

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Insert Header And Footer Sections

Module 4

1.

Open the Orders report in Design View. From the menu, click View >> Report Header/Footer.
The Report Header and Report Footer sections are created, as shown below.

SUMMARY

1. Open the report in Design View. 2. Click View >> Report Header/Footer.

TIPS

You can use the same technique to remove the report header and footer sections.

2003 ComputerTrainingManual.com

74

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Insert Group Header And Footer Sections

Module 4

1.

Open the Orders report in Design View. Click the Sorting and Grouping button on the toolbar.
The Sorting and Grouping dialog box appears.

2.

In the Field/Expression column, select ShipCountry as the first level of grouping. Under Group Properties, in the Group Header box, click Yes.
The ShipCountry header section is created in the report.

SUMMARY

1. Open the report in Design View. 2. Click the Sorting and Grouping button on the toolbar. 3. In the Field / Expression column, select the field to be grouped. 4. Under Group Properties, in the Group Header and/or Group Footer box, click the Yes option.

3.

TIPS

In the Field/Expression column, select OrderDate as the second level of grouping. Under Group Properties, in the Group Header and Group Footer boxes, click Yes.
The OrderDate header and footer sections are created in the report.

You can use the same technique to remove the group header and footer sections.

The group header and footer sections appear in the report as shown below.

2003 ComputerTrainingManual.com

75

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Insert Controls And Labels Into Sections

Module 4

1.

Open the Orders report in Design View. Drag and drop the ShipCountry, OrderDate, OrderID and CustomerID fields from the Field List to the report design. Resize the controls as shown below.
The labels always accompany the controls when you drag the fields onto the report. Delete all the labels.

SUMMARY

1. Open the report in Design View. 2. Add labels to the report using the Label tool.

2. 3.

Select all controls and click the

Align Left button.

Set all the records to align to the left. You can hold the <Shift> key to select multiple controls.

TIPS

Click the following buttons on the toolbar if the Field List or the Toolbox is hidden. Shows Field List. Shows Toolbox.

Add labels to the report using the Label tool as below. Format for Report Header: Font Size 12pt, Bold, Red. Format for Page Header: Font Size 10pt, Bold, Blue.
The report design is displayed below.

4.

Switch the report to Print Preview.


The report is shown below.

2003 ComputerTrainingManual.com

76

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Customize The Format Of A Control

Module 4

1.

Open the Orders report in Design View. Double-click the OrderDate control.
The Text Box Properties dialog box appears.

SUMMARY

2.

In the Format box, type yyyy.


This is to format the date to show only the year.

1. Open the report in Design View. 2. Double-click the control. 3. In the Format box, specify the format.

TIPS

Date format code d - day m - month y - year

3.

In the Page Header section, edit the Date label to Year.


Click the label once, and then click it again to edit the text.

4.

Switch the report to Print Preview.


The report is shown below. Notice that even the OrderDate control is in the OrderDate Header section (records should be grouped by the OrderDate), the records remain ungrouped because the section treats the OrderDate as an individual date instead of a year.

2003 ComputerTrainingManual.com

77

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Change The Properties Of A Group

Module 4

1.

Open the Orders report in Design View. Click the Sorting and Grouping button.
The Sorting and Grouping properties dialog box appears.

2.
SUMMARY

Click the OrderDate grouping row. Under Group Properties, in the Group On box, click Year.
This is to set the section to group the records by year instead of by day.

1. Open the report in Design View. 2. Click the Sorting and Grouping button. 3. Click the grouping level row. 4. Under Group Properties, change the settings.

3.

Switch the report to Print Preview.


The records are grouped by year, as shown below.

Group Properties
Group Header Group Footer Group On Group Interval Keep Together

Description
To display the group header section. To display the group footer section. To group by value or range of values. Interval or no. of characters to group on. To keep parts of a group (the group header, detail and footer section) together on the same page.

2003 ComputerTrainingManual.com

78

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Change The Properties Of A Section

Module 4

1.

Open the Orders report in Design View. Double-click the Page Header section divider line.
The Section Properties dialog box appears.

2.
SUMMARY

Click the Back Color box, click the select the Grey color.
The color code appears in the back color box.

button and

1. Open the report in Design View. 2. Double-click the section divider line. 3. In the Section Properties dialog box, change the properties.

3.

Switch the report to Print Preview.


The page header color is now changed.

2003 ComputerTrainingManual.com

79

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Insert Analytical Values Into Sections

Module 4

1.

Open the Orders report in Design View. In the OrderDate Footer section, create a text box. Type =Count([OrderID]) in the text box. Edit the label to Total number of orders:.
This is to calculate the total occurrences of the records for the group.

SUMMARY

1. Open the report in Design View. 2. In the group footer section, create a text box. 3. Type the formula for the text box. 4. Edit the label for the text box.

2.

Switch the report to Print Preview.


The total number of orders appears at the end of each OrderDate group.

TIPS

If you place the control at the report footer section, it will calculate the number of orders for the entire report and place it at the end of the report.

Other basic functions that you can use.

Functions =Sum([field]) =Max([field]) =Min([field]) =Average([field]) =Count([field])

Description Calculate the total for the field. Find the maximum value for the field. Find the minimum value for the field. Calculate the average value for the field. Find the number of occurrences of the records.

Note: The first four functions are only for fields that contain values only.

2003 ComputerTrainingManual.com

80

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Insert Page Numbers

Module 4

1.

Open the Orders report in Design View. In the Page Footer section, create a text box. Type =Page &[Page] in the text box. Delete the label.
Quotation marks are used to add a text string to the value in the control. &[Page] is the syntax to display the current page.

SUMMARY

1. Open the report in Design View. 2. In the Page Footer section, create a text box. 3. Type the page number formula. 4. Delete the label.

2.

Switch the report to Print Preview.


The page numbers are displayed at the end of each page.

2003 ComputerTrainingManual.com

81

Microsoft

Access 2003
CREATING ADVANCED REPORTS
Creating A Chart Report
You can produce a chart report easily with the chart wizard.

Module 4

Charts are visually appealing and make it easy for users to see comparisons, patterns, and trends in data. In Microsoft Access, you can create charts in a form, report, or data access page. In a form or report, you can use Microsoft Graph to create a chart linked to data from the available tables, queries, or other record sources. The charts can be global (including all data) or record-bound (reflecting data only from the current record, in which case the chart is updated as you move from record to record). Several chart types, including two-dimensional (2-D) and three-dimensional (3-D) types, are available for you to choose from. Formatting options include adding text and graphics to the charts, changing colors, and adding trendlines and error bars.

2003 ComputerTrainingManual.com

82

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Create A Chart Report Using The Wizard

Module 4

1.

From the Object Bar, click the Reports button. Click New button. In the New Report dialog box, the click Chart Wizard and select Employees as the source.
The New Report dialog box appears, as shown below.

SUMMARY

1. Click the New button. 2. In the New Report dialog box, select Chart Wizard and the source. 3. Click the OK button. 4. Select the fields and then click the Next button. 5. Select the chart type and then click the Next button. 6. Drag the field button to the Data and Series box. 7. Click the Next button to change the chart title. 8. Click the Finish button.

2.

Click the OK button. Send both the EmployeeID and City fields to the Fields for Chart box.
Select the fields, and then click . Both fields are to be used in the chart.

2003 ComputerTrainingManual.com

83

Microsoft

Access 2003
CREATING ADVANCED REPORTS
How To Select The Chart Type And Layout

Module 4

3.

Click the Next button. Select Pie Chart.


The Chart Wizard dialog box lets you select different chart type as listed below.

4.

Click the Next button. Drag the EmployeeID button to the Data box. Drag the City button to the Series box as shown below.
EmployeeID is changed to CountOfEmployeeID because it does not contain a value. Double-click a number or date field in the chart to change how the chart will summarize or group data.

2003 ComputerTrainingManual.com

84

Microsoft

Access 2003
CREATING ADVANCED REPORTS
5.

Module 4

Click the Next button to change the title of the chart. Then click the Finish button.
The pie chart is created and appears in print preview.

2003 ComputerTrainingManual.com

85

Automating A Database With Macros

Objectives:

When you have completed these lessons, you will be able to:
Create macros Run macros Edit and rename macros Create a macro group Create a button to run macro Pick a record using macro Use a conditional macro Secure a database with Autoexec macro

2003 ComputerTrainingManual.com

86

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
Working With Macros

Module 4

A macro is a single or series of actions that perform a particular task, like opening a form or printing a report. Macros help you to automate daily tasks such as printing a report when a user clicks a command button that activate the macro. You can organize macros in a macro group. If you have numerous macros, grouping related macros in groups can help you to manage your database more easily. In some cases, you may want to carry out an action or series of actions in a macro only if a particular condition is met. A Conditional expression is used to apply a predetermined condition to a macro. Action arguments vary for each action. They are additional information required by the macro actions. These arguments give Microsoft Access additional information on how to carry out the action.
Macro group contains macros that are separated by blank rows Conditional expression determines the execution of the actions A macro composed of a sequence of actions

Action Arguments let you specify additional information on how to carry out the action

2003 ComputerTrainingManual.com

87

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS

Module 4

To start this lesson, please create a new blank database and save it as Training4. Import the following objects from the Northwind.mdb database. Table: Products, Categories Query: Alphabetical List of Products Form: Products Report: Alphabetical List of Products

How To Create A Macro

1.

From the Object Bar, click Macros. Click the New button.
The macro design window appears.

2.
SUMMARY

1. From the Object Bar, click Macros. Click the New button. 2. In the Action column, select the Action you want. 3. In the Comment column, type the comments. 4. Under Action Arguments, select the suitable action arguments.

In the Action column, click the drop-down arrow at the first row and select OpenReport. Under Action Arguments, in the Report Name box, select Alphabetical List of Products. In the View box, select Print Preview.
This action will open the Alphabetical List of Products report in Print Preview. The Comment column, which is optional, lets you add some remarks to the actions.

TIPS

Different Actions have different sets of Action Arguments. E.g. The OpenForm action has the following arguments:

3.

Click the Save button. In the Macro Name box, type OpenProductList as the macro name.
If you close the macro window without saving, Access will prompt you to save your macro.

4.

Click the OK button.


The macro appears in the database window.

2003 ComputerTrainingManual.com

88

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Run A Macro

Module 4

1.

From the Object Bar, click the Macros button.


All the available macros are listed in the database window.

SUMMARY

1. From the Object Bar, click the Macros button. 2. Double-click the macro you want to run.

TIPS

You can also select the macro and then click the Run button in the Database Window to run the macro.

2.

Double-click the OpenProductList macro.


The macro is run, and the Alphabetical List of Products report is opened.

3.

Click the

Close button.

The report preview window closes.

2003 ComputerTrainingManual.com

89

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Edit And Rename A Macro

Module 4

1. 2.

From the Object Bar, click the Macros button.


All the macros are listed in the database window.

Click the OpenProductList macro. Then, click the Design button.


The macro opens in Design View.

SUMMARY

3.

1. From the Object Bar, click the Macros button. 2. Double-click the macro you want to open. 3. Click the Design button. 4. Edit the macro. 5. Close the macro. 6. Right-click the macro name in the database window. 7. Click Rename from the shortcut menu. 8. Type the new name. 9. Press <Enter>.

Under Action Arguments, in the View box, change Print Preview to Print.
The report is sent to the printer immediately when you run the macro.

TIPS

4. 5.

Click the Close button.


The macro is closed.

You can also rightclick the macro, and then click Design View from the shortcut menu to edit the macro.

In the Database Window, right-click the macro OpenProductList. Click Rename from the shortcut menu.
You will rename the macro.

6.

Type Switchboard as the new macro name. Then press <Enter>.


The macro name is changed to Switchboard.

2003 ComputerTrainingManual.com

90

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Group Macros

Module 4

1. 2.

Open the Switchboard macro in the Design View.


You are going to change this macro to a group macro.

Click the

Macro Names button.

The Macro Name column appears.


SUMMARY

3.

In the Macro Name column, type PrintProductList.


This is the first macro in this group of macros. This macro is now named Switchboard.PrintProductList.

1. Open the macro in Design View. 2. Click the Macro Name button. 3. In the Macro Name column, type the name of the macro. 4. Insert a blank row as the first row.

4.

Type in the second macro and select the actions as shown below.
You have to leave a blank row to separate the macros in the group. This macro is named Switchboard.DisplayProdut. This macro opens Products form, and then maximizes the form.

5.

Click the PrintProductList macro, then click the Insert Rows button.
A blank row is inserted above the first macro. Since this is a group macro, the first row needs to be blank so that when you double-click the Switchboard macro, it wont run any actions. To run the first macro, you must specify the full macro name, Switchboard.PrintProductList.

2003 ComputerTrainingManual.com

91

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Insert A Button To Run A Macro

Module 4

1.

Create a new empty form and save it as Switchboard. Add a label Product Switchboard, as shown below.
To create an empty form, do not select a record source. Double-click Create Form in Design View to create the empty form.

SUMMARY

1. Open the form in Design View. 2. Click the Command Button tool on the toolbox. 3. Click the location on the form where you want to create a command button. 4. In the Categories box, click the Miscellaneous category. In the Actions box, click the Run Macro action. 5. Click Next to select the Macro Name. 6. Click Next to select the button appearance. 7. Click the Finish button.

2.

Click the Command Button button on the toolbox. Click the location on the form where you want to create a command button.
In order to go through the Command Button wizard, the wizard button on the toolbox must be selected.

3.

In the Categories box, click the Miscellaneous category. In the Actions box, click the Run Macro action.
This command button will run a macro when clicked.

TIPS

You can still change and reassign another macro to the button after completing the wizard. Open the Command Button properties dialog box. In the On Click box, change the macro name.

2003 ComputerTrainingManual.com

92

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
4.
Click the Next button. In the box, click the Switchboard.PrintProductList macro.

Module 4

Select the macro that will run when the command button is clicked.

5.

Click the Next button. Click the Text option button. In the box beside the Text option, type Print Product List.
You can also display a picture on the button if you want. Click the Picture option, and then click the Browse button to add the picture to the button.

6.

Click the Next button. Type PrintProductList as the button name. Click the Finish button.
The command button is created on the form. If you click the button in the form view, the report is sent for printing.

2003 ComputerTrainingManual.com

93

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Filter A Record Using A Macro

Module 4

1.

Create a text box on the Switchboard form. Type Enter Product ID: as the label and change the control name to ProductID.
Make sure the text box properties dialog box appears.

SUMMARY

1. Open the macro in the Design View. 2. Click the OpenForm action. 3. Under Action Arguments, in the Where Condition box, type the syntax.

2.

Create another command button Display Product Details and assign the Switchboard.DisplayProduct macro to the button.
Resize and move the button to the right of the ProductID text box. You are going to edit the Switchboard.DisplayProduct macro so that when the button is clicked, the Product Form will display the product details (the Product ID specified in the ProductID text box control).

TIPS

This macro does not work if the product ID is blank. If you click the Display Product Details button without specifying the Product ID, a blank form appears. The next task will show you how to prompt the user to enter the product ID.

3.

Click the Switchboard.DisplayProduct macro. In the Where Condition box for the OpenForm action, type
[ProductID]=[Forms]![Switchboard]![ProductID].
Remember to click the OpenForm action to see the action arguments. This syntax will display the record that has the ProductID equivalent to the ProductID found on the Switchboard form. Important: Part of the syntax is not shown in the illustration below. You can press <Shift>+<F2> to display a zoom window for the syntax.

2003 ComputerTrainingManual.com

94

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
4.

Module 4

Save and close the macro. Open the Switchboard form. In the Product ID: text box, type 5.
The form appears as shown below.

5.

Click the Display Product Details button.


The product details are displayed in Product form.

2003 ComputerTrainingManual.com

95

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Create A Conditional Macro

Module 4

1.

Open the Switchboard macro in Design View. Click the Conditions button on the toolbar.
The Condition column appears.

2.

SUMMARY

For the DisplayProduct macro, in the Condition column, type IsNull([ProductID]) and in the Action column, select the MsgBox action. Under Action arguments, in the Message box, type Please enter the product ID and in the Title box, type Product ID Error.
Use the insert rows button to insert a row above the OpenForm action. This macro will prompt a message box if the ProductID control is Null (empty).

1. Open the macro in Design View. 2. Click the Conditions button on the toolbar. 3. Type the expression in the Condition column. 4. Save the macro.

3.

Insert another row. In the Condition column, type.... In the Action column, select the StopMacro action.
` means the condition is as above. StopMacro is needed to stop the macro or else the next action (OpenForm) will still run after the massage box appears.

4.

Save and close the macro. Open the Switchboard form to test the macro.
This message box appears if you click Display Product Details button without specifying the Product ID.

2003 ComputerTrainingManual.com

96

Microsoft

Access 2003
AUTOMATING A DATABASE WITH MACROS
How To Secure A Database With An Autoexec Macro

Module 4

1. 2.

Create a new macro and save it as Autoexec.


You must use this name so that Access will automatically run the macro when the database is open.

Create the actions to open the Switchboard form and then Maximize the form as shown below.
The Switchboard form will maximize automatically when the database is opened.

SUMMARY

1. Create a new macro. 2. Save the macro as Autoexec. 3. In the Action column, select the OpenForm action. 4. Under Action Arguments, in the Form Name box, specify the form you want to open. 5. Maximize the form.

3.
TIPS

Save and close the macro. Close the database. Open the database again.
The Switchboard appears automatically and fills the entire screen. Users do not see the Database Window and this helps to prevent users from manipulating the database objects.

If you want to skip the autoexec macro when you open the database, hold down the <Shift> key when you open the database.

2003 ComputerTrainingManual.com

97

Anda mungkin juga menyukai