Upload
hadiep
View
217
Download
3
Embed Size (px)
Citation preview
ITS@PennState224B Computer BuildingUniversity Park, PA [email protected]://its.psu.edu/training/
Information Technology Services
MS Access: Creating
Advanced Form Design
Alternative Format StatementThis publication is available in alternative media upon request.
Statement of Non-DiscriminationThe Pennsylvania State University is committed to the policy that all persons shall have equal access to programs, facilities, admission, and employment without regard to personal characteristics not related to ability, performance, or qualifications as determined by University policy or by state or federal authorities. The Pennsylvania State University does not discriminate against any person because of age, ancestry, color, disability or handicap, national origin, race, religious creed, sex, sexual orientation, or veteran status. Direct all inquires regarding the nondiscrimination policy to the Affirmative Action Director, The Pennsylvania State University, 328 Boucke Building, University Park, PA 16802-5901; tel. (814) 865-4700; TDD (814)863-1150.
Table of ContentsObjectives........................................................................................................2
Adding Graphics...............................................................................................3
Unbound Object Frame Controls......................................................................3
Adding Calculations........................................................................................5
Creating a Calculated Control in a Form.........................................................6
Aligning Controls in a Form.............................................................................7
Adding Combo Boxes......................................................................................7
Adding Unbound Controls.............................................................................10
Tab Order......................................................................................................12
Independent Practice Activity........................................................................13
Additional Resources.....................................................................................13
Objectives Add a graphic control to a form
Embed a graphic in an unbound object frame
Bind a control to a calculated field
Add calculated fields to a form
Insert a combo box and modify its properties
Format controls in a form
Insert unbound controls
Change the control tab order
MS Access: Creating Advanced Form Design Page 2 Spring 2003
Adding Graphics
Unbound Object Frame Controls
You can use unbound object frames to embed objects such as graphics, Word documents, Excel spreadsheets and so forth into your forms.
MS Access: Creating Advanced Form Design Page 3 Spring 2003
Open up the form to which you want to add a graphic.
In the toolbox, click on the Image Control Wizard.
Drag a box in the section of the form to which you want to add a graphic.
Navigate to the file where the image is stored.. Select the image file and click Ok.
Your form should now look like this. Switch to Form view and observe.
Select the Unbound object frame from the toolbox.
Drag a box in the section of the form to which you want to add the object.
Choose Create from File.
Navigate to the file where the object is stored. Select the object, then click Ok.
MS Access: Creating Advanced Form Design Page 4 Spring 2003
It should now look like this.
Once the path to the file you wish to embed in your form is showing in the window, click Ok.
The final result should look like this in Design view on your form.
Switch to Form view to observe the results.
Verify that the unbound object frame is still selected and click on the Properties button on the toolbar.
On the All tab, go to the Border Style cell and choose Dots from the drop-down list.
Close the Properties window.
Switch to Form view to observe the change.
Adding Calculations
To create a calculated control, you need to bind the control to a calculated field in a query, report, or another form. You can also create a control, and then specify the expression to perform the calculations in the control.
MS Access: Creating Advanced Form Design Page 5 Spring 2003
In Design view, click on the Text Control Wizard in the toolbox.
Drag a box with your cursor onto the form.
It should look like this.
Click the label control, then click on the Properties button in the toolbar.
Change the label caption to Order Amount.
Switch to Form view and observe the results. The contents of the calculated field appear in the text box control.
Creating a Calculated Control in a Form
MS Access: Creating Advanced Form Design Page 6 Spring 2003
Now, select the text control and click on the Properties button on the toolbar.
Select Amount from the Control Source list and Currency from the Format list.
Close the Property window.
The text control should now look like this. It is now linked to the Amount calculated field in the Order_values query.
Create a text box control in the form’s Design view. Change the label caption to read Amount.
Open the Properties for the text box control. In the Control Source cell type =[Quantity]*[Unit_price]
Change the Format to Currency
Change the Decimal Places to 2
Close the Property window
Aligning Controls in a Form
Adding Combo Boxes
You can add combo boxes to a form when you want the user to enter data as well as select data from a list.
MS Access: Creating Advanced Form Design Page 7 Spring 2003
Switch to Form view and observe the results.
Select two or more controls you wish to align.
Go to the Format menu, choose Align, then select Left.
Switch to Form view and observe the aligned results. Both controls should be aligned left.
Click on the Combo Box Control Wizard.
Drag a box onto the form.
MS Access: Creating Advanced Form Design Page 8 Spring 2003
Choose whether you want the combo box to look up values in a bound table or query or type new values.
In this example, use the first option to look up values in a table or query.
Click Next.
Under the View section, check whether the values are from Tables, Queries or Both.
Select the Table or Query from which you want to create the combo box.
Click Next.
Move the field you wish to extract values from to the Selected fiels window.
Click Next.
MS Access: Creating Advanced Form Design Page 9 Spring 2003
In this step, you can adjust the column width for the combo box if you wish.
Click Next.
Select Store that value in this field.
Choose the appropriate field from the drop-down list.
Click Next.
Name the combo box.
Click Finish.
Observe your results in Form view.
Adding Unbound Controls
You can add an unbound control in a form to display data that isn’t linked to any field.
MS Access: Creating Advanced Form Design Page 10 Spring 2003
It should look like this.
Click on the drop-down menu to see the list of Customer IDs from which to choose.
Open the properties for the combo box control.
Click on the All tab.
Change the Name cell to read Customer_ID.
Change the Default Value to be C001.
Close the Property window and switch to Form view.
Add a new record and view your results.
Click on the label control wizard to add an unbound label to your form.
Drag a box onto your form.
Type a caption into the new label.
Switch to Form view and observe the results.
MS Access: Creating Advanced Form Design Page 11 Spring 2003
To format the label control, click on it to select it, then use the Formatting toolbar to change the Font Size, Font Color, Alignment within the control box, etc.
To draw a rectangle around a control, select the Rectangle Control Wizard from the toolbox and drag a rectangle around the label control that is already on your form.
Switch to Form View to observe the results.
It should look like this.
To change the rectangle properties, select the rectangle in Design view, then click on the Properties button in the toolbar.
Click on the All tab.
Change the Border Width to 2.
Switch to Form view and observe your results.
Tab Order
You can set the tab order in a form so that you can enter data in a specific order.
MS Access: Creating Advanced Form Design Page 12 Spring 2003
In Design view, click on the View menu and select Tab Order.
Select the form section for which you want to adjust the tab order.
Highlight the field you wish to move by clicking in the gray box to the left of the field.
Drag the field to it’s new tab order location.
Click Ok.
Switch to Form view and observe your results. Tab through the fields and see the updated tab order.
Independent Practice Activity
Open Forms
Modify the Sales_by_retailer form by adding the following to the Header section:
A label control with Outlander Spices as the caption An image control using the Spice_picture graphic A rectangle around the label and image controls
Change the tab order of the controls in the Detail section of Sales, Retailer_code, and Retailer_name
Update the form and switch to Form view
Close the form
Close the database
Additional Resources
MS Access 2002 Help
Help menu (Contents, Answer Wizard, Index tabs)F1Ask a Question boxOffice Assistant
Books
Special Edition Using Microsoft Access 2002 by Roger Jennings The Complete Reference: Access 2002 by Virginia AndersenMastering Access 2002 by Alan Simpson and Celeste RobinsonTeach Yourself Microsoft Access 2002 Visually by Ruth Maran Instant Access Databases by Greg Buczek Microsoft Access 2002 Bible by Cary N. Prague and Michael R. Irwin Sams Teach Yourself Microsoft Access 2002 in 10 Minutes by Faithe Wempen Microsoft Access 2002: At A Glance by PerspectionMicrosoft Access 2002: Step By Step by Catapult, Inc.Running Microsoft Access 2002 by John ViescasMicrosoft Pocket Guide to Microsoft Access 2002 by Stephen L. Nelson
MS Access: Creating Advanced Form Design Page 13 Spring 2003
Websites
http://its.psu.edu/training/http://www.fgcu.edu/support/office2000/access/index.htmlhttp://www.cant.ac.uk/title/tutorials/access.htmhttp://www.microsoft.com/office/access/default.htmhttp://www.microsoft.com/office/access/using/default.htmhttp://www.cyber-matrix.com/access.htmhttp://www.course.com/downloads/NewPerspectives/office2000/access_main.htmlhttp://www.customguide.com/demos/access2000_2.pdf#page=13http://databases.about.com/cs/tutorials/http://ittraining.westmont.edu/access/tutorials.htmlhttp://cisnet.baruch.cuny.edu/holowczak/classes/2200/access/accessall.html
Phone Numbers
Help Desks (215 Computer Bldg 863-2494 and 2 Willard Bldg 863-1035)Seminar Line 863-9522
MS Access: Creating Advanced Form Design Page 14 Spring 2003