Microsoft Access (part 3)




Forms

Creating Form by Using Wizard
Forms are used as a way to enter data into a database table. Forms create data in efficient manner.

To create a form using the assistance of the wizard, follow these steps:
1. Click the Create form by using wizard option on the database window.

2. From the Tables/Queries drop-down menu, select the table or query whose datasheet the form will modify. Then, select the fields that will be included on the form by highlighting each one the Available Fields window and clicking the single right arrow button > to move the field to the Selected Fields window.
To move all of the fields to Select Fields, click the double right arrow button >>. If you make a mistake and would like to remove a field or all of the fields from the Selected Fields window, click the left arrow < or left double arrow << buttons. After the proper fields have been selected, click the Next > button to move on to the next screen.


3. On the second screen, select the layout of the form.
a. Columnar - A single record is displayed at one time with labels and form fields listed side-by-side in columns.

b. Justified - A single record is displayed with labels and form fields are listed across the screen.

c. Tabular - Multiple records are listed on the page at a time with fields in columns and records in rows.

d. Datasheet - Multiple records are displayed in Datasheet View.

Click the Next > button to move on to the next screen.


Select a visual style for the form from the next set of options and click Next >.


On the final screen, name the form in the space provided. Select "Open the form to view or enter information" to open the form in Form View or "Modify the form's design" to open it in Design View. Click Finish to create the form


Creating Form in Design View
To create a form from scratch without the wizard, follow these steps:
1. Click the New button on the form database window.

2. Select "Design View" and choose the table or query the form will be associated with the form from the drop-down menu.

3. Select View|Toolbox from the menu bar to view the floating toolbar with additional options.



Add controls to the form by clicking and dragging the field names from the Field List floating window. Access creates a text box for the value and label for the field name when this action is accomplished. To add controls for all of the fields in the Field List, double-click the Field List window's title bar and drag all of the highlighted fields to the form.



Adding Records Using a Form
Input data into the table by filling out the fields of the form. Press the Tab key to move from field to field and create a new record by clicking Tab after the last field of the last record. A new record can also be created at any time by clicking the New Record button at the bottom of the form window. Records are automatically saved as they are entered so no additional manual saving needs to be executed



Editing Forms
The follow points may be helpful when modifying forms in Design View.

1. Grid lines - By default, a series of lines and dots underlay the form in Design View so form elements can be easily aligned. To toggle this feature on and off select View|Grid from the menu bar.

2. Snap to Grid - Select Format|Snap to Grid to align form objects with the grid to allow easy alignment of form objects or uncheck this feature to allow objects to float freely between the grid lines and dots.

3. Resizing Objects - Form objects can be resized by clicking and dragging the handles on the edges and corners of the element with the mouse.

4. Change form object type - To easily change the type of form object without having to create a new one, right click on the object with the mouse and select Change To and select an available object type from the list.

5. Label/object alignment - Each form object and its corresponding label are bounded and will move together when either one is moved with the mouse. However, to change the position of the object and label in relation to each other (to move the label closer to a text box, for example), click and drag the large handle at the top, left corner of the object or label.

6. Tab order - Alter the tab order of the objects on the form by selecting View|Tab Order... from the menu bar. Click the gray box before the row you would like to change in the tab order, drag it to a new location, and release the mouse button.


7. Form Appearance - Change the background color of the form by clicking the Fill/Back Color button on the formatting toolbar and click one of the color swatches on the palette. Change the color of individual form objects by highlighting one and selecting a color from the Font/Fore Color palette on the formatting toolbar. The font and size, font effect, font alignment, border around each object, the border width, and a special effect can also be modified using the formatting toolbar:


8. Page Header and Footer - Headers and footers added to a form will only appear when it is printed. Access these sections by selecting View|Page Header/Footer on the menu bar.


Form control
This page explains the uses for other types of form controls including lists, combo boxes, checkboxes, option groups, and command buttons.

List and Combo Boxes
If there are small, finite number of values for a certain field on a form, using combo or list boxes may be a quicker and easier way of entering data. These two control types differ in the number of values they display. List values are all displayed while the combo box values are not displayed until the arrow button is clicked
1. Open the form in Design View.

2. Select View|Toolbox to view the toolbox and make sure the "Control Wizards" button is pressed in.

3. Click the list or combo box tool button and draw the outline on the form. The combo box wizard dialog box will appear.

4. Select the source type for the list or combo box values and click Next >.


5. On the next dialog box, set the width of the combo box by clicking and dragging the right edge of the column. Click Next >.



6. The next dialog box allows tells Access what to do with the value that is selected. Choose "Remember the value for later use" to use the value in a macro or procedure (the value is discarded when the form is closed), or select the field that the value should be stored in. Click Next > to proceed to the final screen.



Check Boxes and Option Buttons
Use check boxes and option buttons to display yes/no, true/false, or on/off values. Only one value from a group of option buttons can be selected while any or all values from a check box group can be chosen. Typically, these controls should be used when five or less options are available. Combo boxes or lists should be used for long lists of options. To add a checkbox or option group:
1. Click the Option Group tool on the toolbox and draw the area where the group will be placed on the form with the mouse. The option group wizard dialog box will appear.

2. On the first window, enter labels for the options and click the tab key to enter additional labels. Click Next > when finished typing labels

On the next window, select a default value if there is any and click Next >.


Select values for the options and click Next >.


Choose what should be done with the value and click Next >.


Type the caption for the option group and click Finish.
This page explains the uses for other types of form controls including lists, combo boxes, checkboxes, option groups, and command buttons.


List and Combo Boxes
If there are small, finite number of values for a certain field on a form, using combo or list boxes may be a quicker and easier way of entering data. These two control types differ in the number of values they display. List values are all displayed while the combo boxvalues are not displayed until the arrow button is clicked to open it.
1. Open the form in Design View.

2. Select View|Toolbox to view the toolbox and make sure the "Control Wizards" button is pressed in.

3. Click the list or combo box tool button and draw the outline on the form. The combo box wizard dialog box will appear.

4. Select the source type for the list or combo box values and click Next >.


5. Depending on your choice in the first dialog box, the next options will vary. If you chose to look up values from a table or query, the following box will be displayed. Select the table or query from which the values of the combo box will come from. Click Next > and choose fields from the table or query that was selected. Click Next > to proceed.


6. On the next dialog box, set the width of the combo box by clicking and dragging the right edge of the column. Click Next >.


7. The next dialog box allows tells Access what to do with the value that is selected. Choose "Remember the value for later use" to use the value in a macro or procedure (the value is discarded when the form is closed), or select the field that the value should be stored in. Click Next > to proceed to the final screen.


8. Type the name that will appear on the box's label and click Finish.


Check Boxes and Option Buttons
Use check boxes and option buttons to display yes/no, true/false, or on/off values. Only one value from a group of option buttons can be selected while any or all values from a check box group can be chosen. Typically, these controls should be used when five or less options are available. Combo boxes or lists should be used for long lists of options. To add a checkbox or option group:
1. Click the Option Group tool on the toolbox and draw the area where the group will be placed on the form with the mouse. The option group wizard dialog box will appear.

2. On the first window, enter labels for the options and click the tab key to enter additional labels. Click Next > when finished typing labels.


3. On the next window, select a default value if there is any and click Next >.


4. Select values for the options and click Next >.


5. Choose what should be done with the value and click Next >.


6. Choose the type and style of the option group and click Next >.


7. Type the caption for the option group and click Finish.


Command Buttons
In this example, a command button beside each record is used to open another form.
1. Open the form in Design View and ensure that the Control Wizard button on the toolbox is pressed in.

2. Click the command button icon on the toolbox and draw the button on the form. The Command Button Wizard will then appear.

3. On the first dialog window, action categories are displayed in the left list while the right list displays the actions in each category. Select an action for the command button and click Next >.


4. The next few pages of options will vary based on the action you selected. Continue selecting options for the command button.

5. Choose the appearance of the button by entering caption text or selecting a picture. Check the Show All Pictures box to view the full list of available images. Click Next >.


6. Enter a name for the command button and click Finish to create the button.



Reports

Report Using the Wizard
Reports will organize and group the information in a table or query and provide a way to print the data in a database.

Create a report using Access' wizard by following these steps:
1. Double-click the "Create report by using wizard" option on the Reports Database Window.

Select the information source for the report by selecting a table or query from the Tables/Queries drop-down menu. Then, select the fields that should be displayed in the report by transferring them from the Available Fields menu to the Selected Fields window using the single right arrow button > to move fields one at a time or the double arrow button >> to move all of the fields at once. Click the Next > button to move to the next screen.



Select fields from the list that the records should be grouped by and click the right arrow button > to add those fields to the diagram. Use the Priority buttons to change the order of the grouped fields if more than one field is selected. Click Next > to continue



If the records should be sorted, identify a sort order here. Select the first field that records should be sorted by and click the A-Z sort button to choose from ascending or descending order. Click Next > to continue.



Select a layout and page orientation for the report and click Next >.



Select a color and graphics style for the report and click Next >.



On the final screen, name the report and select to open it in either Print Preview or Design View mode. Click the Finishbutton to create the report.



Creating report in Design View
To create a report from scratch, select Design View from the Reports Database Window.

Click the New button on the Reports Database Window. Highlight "Design View" and choose the data source of the report from the drop-down menu and click OK.



You will be presented with a blank grid with a Field Box and form element toolbar that looks similar to the Design View for forms. Design the report in much the same way you would create a form. For example, double-click the title bar of the Field Box to add all of the fields to the report at once. Then, use the handles on the elements to resize them, move them to different locations, and modify the look of the report by using options on the formatting toolbar. Click the Print View button at the top, left corner of the screen to preview the report.



Printing Reports
Select File|Page Setup to modify the page margins, size, orientation, and column setup. After all changes have been made, print the report by selecting File|Print from the menu bar or click the Print button on the toolbar.

No comments:

Post a Comment