Published on

Published in: Education, Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. Introduction to Microsoft Access Part 4 – Forms The purpose of any form, whether paper based or electronic, is to capture information. Because many people get confused when filling out forms, it is important that their design is as simple as possible.1. Creating AutoFormsStart by opening the Northwind Database and delete all the existing forms. Nowopen one of the tables in Datasheet View and enter data into the table. Doing this is arelatively simple process. What then, is the point of creating forms for Accessdatabases? • Forms allow you to focus on one record at a time with all the data pleasantly laid out on the screen. • You can edit the form at any time by switching to Design View and you dont have to worry about recycling 10,000 copies of the old form, as you would if the form was a PBF (Paper Based Form). • You can build several forms for different groups of users to reflect their different needs. • You can use the form to view the contents of tables or the results of queries. • One form can be used to enter data into several tables. Forms automatically use the relationships built into your database.1. Click on the Forms tab of your Database Window.2. Click New and choose between the three types of AutoForm.Page 1 of 10 7/4/2012
  2. 2. The three types of AutoForm are: Columnar Produces a simple one-record-per-form view Tabular Shows multiple records on a form Datasheet Produces a form that looks almost exactly like a table in Datasheet View.3. Choose the Columnar AutoForm and select the Customers Table. You shouldend up with something like this:4. Give the form a title and save it.Your TaskTry creating a Tabular AutoForm and a Datasheet AutoForm, both based on theCustomers Table. Compare the layout of the three forms.1. Which layout is the simplest?2. What is the point of creating a Datasheet form, when you could just open a tablein Datasheet View to enter data?3. What is the advantage of the Tabular form?4. Was there any problem with the layout of the Tabular AutoForm?Page 2 of 10 7/4/2012
  3. 3. 2. Creating a Form with the Form WizardThe Form Wizard is much more versatile than the AutoForms and it allows you toselect fields from several tables and/or queries.1. Go to the Forms tab of your Database Window. Click New and then DoubleClick the Form Wizard.2. Select the fields you want to use in your form from any table or query. If you usemore than one table or query, the Wizard will ask you how you want the form to bearranged.3. You will be asked what layout you want. Choose between Columnar, Tabular,Datasheet and Justified (Columnar produces the simplest layout).4. You can then choose thecolour and background styles.Choose the standard option tobegin with because many ofthese colour options slow downthe performance of your form.5. Name your form and then click Finish.Your Task1. Delete the three forms that were created with AutoForm.2. Using the Form Wizard, create a form what uses fields from more than one table.Think carefully about the sort of forms that Northwind will need and create a formthat will suit their purposes.3. Test the form by entering a few records. Is data entry intuitive and problem-free?4. What do each of these buttons at the bottom of the form do?5. Evaluate your form. Did the Form Wizard produce a perfect form? Are there anylayout problems? How could the layout be improved?Page 3 of 10 7/4/2012
  4. 4. 3. Taking the Form into Design View1. With your form open, click the Design View button.If you have previously worked with reports, this screen will be familiar to youbecause it is very similar to the Reports Design View. Objects can be moved, edited,re-sized and aligned in exactly the same way.2. Click the appropriate button in the Toolbox to enter lines and boxes. Resize ormove them with the Pointer tool. When an object is selected, the large selectionhandle moves the object and the other selection handles resize the object. Large selection handle moves an object line Small selection handles resize an object Square/rectangle3. You can change the colour of any object. You can alter the Line/Border Widthand you can add special effects. The Format Painter is a useful way of applying thesame visual style to all your labels and/or data boxes. OLE Objects can be added toforms, just as they can be added to reports.4. You have a Header and Footer, in which you can place objects that will appear atthe top or bottom of your form.5. Just as in the Report Design View, you can double-click on any Object (e.g. adata box, a label or a form section) to bring up a Properties dialog box. Click theForm Properties button to make changes that affect the behaviour of the whole form.Your TaskImprove the layout of yourform, change the colourscheme, add a header andpreview the results.Page 4 of 10 7/4/2012
  5. 5. 4. Change the Tab OrderWhen people enter data into a form, they usually use the Tab key to move betweenfields. If you move the data boxes around in Design View you will notice, when youpreview the Form in Form View that Access has remembered the old tab order. Thiswill be confusing for people using the form. The solution is to return to Design Viewand update the Tab Order.1. Select Tab Order from the View Menu. The Tab Order dialog box appears:2. Click on the grey button next to a field and drag it to the desired position.3. When youre satisfied, click OK and test the new tab order in Form View.Your Task1. Change the order of thedata boxes on your form.Then update the TabOrder.2. Add the date and time tothe Form Footer (theprocess for doing this is thesame as for reports).3. Remove the Scroll Barsfrom your form. To achievethis, you will need to editthe Form Properties.4. Preview the results ofthese changes in FormView.Page 5 of 10 7/4/2012
  6. 6. 5. SubformsA Subform is a "form within a form". The form in the example below is based ontwo tables called Categories and Products. The main form is based on theCategories table and the Products table is the subform. When the BeveragesCategory is selected, the Products subform displays only products in that category.You will use the Northwind Database to create a form based on the Orders tablethat uses the Products table as a subform.The purpose of creating this subform is: • Whilst employees are taking orders, they can see the details of the items being ordered. • The employee can change data in the Products table without leaving the Orders form.1. Start the Form Wizard.2. Add fields from the Orders table and the Products table.3. You are then asked how you want to view the data. If you view by the Orderstable, you ensure that Orders is the form and Products is the subform.4. Choose a Tabular or a Datasheet view.5. Complete the wizard and your form is created. Notice how the wizard hashelpfully created some combo (drop-down) boxes to aid data entry in certain fields.For Discussion1. Why is it important to make sure that relationships are set up properly beforecreating a subform?2. How do the combo boxes contribute to data validation?Page 6 of 10 7/4/2012
  7. 7. 6. Adding a Subform to an Existing Form1. Create a second form based on the Orders table. We want a simple form asquickly as possible, so use the Columnar AutoReport to make the form.2. Switch to Design View and enlarge the Detail Section so that there is room for thesubform:3. Ensure that the Control Wizards Controlare turned on and click the SubForm/ Wizards onSubreport button on the Toolbox: Subform/ Subreport4. Add the subform to your form and a wizard will start. Simply tell the wizard thatyou want to base the subform on the Products table and it will create the subform foryou. Ignore the page about linked fields.5. Re-size the subform as necessary and preview the results in Form View. Thenreturn to Design View and open the subforms Properties. Customise your subformby adding a Border Colour and a Special Effect.Your Task1. Turn the Control Wizards off and then try to create a subform. What do younotice?2. Your boss has asked you to make some changes to the form that prevent usersfrom closing, moving or re-sizing the form while theyre working on it. Open theForm Properties and make some changes that will achieve this.Page 7 of 10 7/4/2012
  8. 8. 7. Combo Boxes and List BoxesCombo boxes are drop-down lists that the Form Wizard, will often create for you.These boxes help with Data Validation by forcing the user to choose an answer froma list. If an operator has to choose an option from a list, there is no danger that s/hewill type in something that is invalid. You can also set a Default Value.1. Open the Music Database that you created in Introduction to Access Part One.2. Create a form using the Form Wizard based on the Albums table. It is importantto use Form Wizard and not the AutoForms because only Form Wizardautomatically generates combo boxes.3. Test the form. You should notice that the combo box is listing the ID numbers ofthe artists and music categories and not the names. This form will clearly be difficultto fill in.4. Take the form into Design View.Open the Properties for the firstcombo box. Make the ColumnCount 2:5. Preview the results. The form should now be listing both the ArtistID and theArtistName. We could do without the ID altogether though, so take the form backinto Design View and change Column Widths to 0 (zero). Preview the form againand it should only list the names of the artists. This is now a much easier form towork with.Your Task1. Go back to Design View and delete thecombo box for the Category field.2. From the Toolbox create a List Box (makesure the Control Wizards are on).3. Base the List Box on the Category field ofthe Category table. Make sure you tell thewizard to store the value selected in theCategories field of the Albums table.4. Align the fields in the form and make theVertical Spacing equal.5. Add visual effects to the List Box by editingthe Properties.6. Test your form by adding details of somealbums. Do you need to change the Tab Order?7. Set a Default Value for your list box.Page 8 of 10 7/4/2012
  9. 9. 7. Keyboard ShortcutsF2 Select an entire fieldCtrl+; Insert the Current DateCtrl+: Insert the Current TimeCtrl+Enter Insert a Line Break (use it in a memo or large text field)Ctrl++ Add New RecordCtrl+- Delete the Current RecordShift+Enter Save the RecordCtrl+Z Undo the last change you made (dont rely on this)Ctrl+Enter Open the selected object in Design ViewAlt+F4 Quit Access8. Summary (from the Access Help file)Page 9 of 10 7/4/2012
  10. 10. Page 10 of 10 7/4/2012