Presentation on theme: "Course Form In the main window (cf. Figure 2), click on Forms, then double-click on Create form by using wizard. Follow the sequence of actions below."— Presentation transcript:
Course Form In the main window (cf. Figure 2), click on Forms, then double-click on Create form by using wizard. Follow the sequence of actions below. Creating Forms
In Figure 12, choose the table that you want to create a form for, in our case Course, then choose all the fields so that they are moved from the Available Fields to Selected Fields. In the figure, this is already done. Press Next. In the second wizard window, choose a layout form (Columnar is our choice). Press Next. In the third wizard window, choose a style (Standard is our choice). Press Next. In the fourth wizard window, choose a name for this form (Course is fine), and keep the option Open the form to view or enter data. Press Finish. Course Form
A window as in Figure 13 appears. It contains data from our Course table. You can browse through the entries with the buttons on the bottom part of the window. Note that the shown labels contain the strings that we chose in the Caption field when the created the table. We can now adjust the layout of the form by entering the form in design view, e.g. by pressing the left-most button on the tool bar. Course Form
Adjust the length of fields by dragging their borders to an appropriate size. Prevent users from editing the primary key by (a) right- clicking in the CourseID field and choosing Properties from the popup menu or (b) by double-clicking on the CourseID field. Properties are your way of managing forms. Get used to the ugly display of information and the sparse information. This is the place where you do all the important changes to a form. Disable the CourseID field by setting the property Enable (in tab All or Data) to No. Close the Properties-window, save the form and open it in form view. It now looks like Figure 15. Course Form
How to get rid of displayed keys in the form. Open the Course form in design view and double click on the field (not the label) CourseInstID. This opens the Property window for the combo box CourseInstID. And now comes the cryptic part which would take ages to find in the documentation! Instead of basing the contents of this combo box on a query that returns only the institution id, we base it on a query that also returns the institution abbreviation. Switch to tab Data. Put the cursor in the field Row Source (where some SQL is displayed) and click on the …-Button that appears to the right of the field. That opens a query editor as shown in Figure 16.
Drag the text InstAbbr from the upper part of the window to the empty column on the lower part of the window so that it appears next to InstID.
How to get rid of displayed keys in the form Close the query builder and save the query. You are now back in the Properties window for CourseInstID. In tab Data, make sure that Bound Column contains a 1 (digit one) if InstID is the first column returned from your query. Switch to tab Format. Change the value for Column Count from 1 to 2 (our query returns now two columns not one). Change the value for Column Widths from something like 2.54cm to 0cm;3cm (meaning that you do not at all want to display the first column (0cm) but the second column with a width of 3cm). This was straightforward, right? Close the Properties-window. Change the label of CourseInstID to e.g. Responsible Institution. Save the form and display it in form view (cf. Figure 18).
Student Form with Course Information In the first wizard window, we choose fields from the following tables Student: All fields Participate: PartCourseID, PartYear Course: CourseName, CourseLevel Institution: InstAbbr, InstName In the second wizard window, choose to see data by student and form with subforms. In the third wizard window, choose Tabular layout. In the fourth wizard window, choose Standard style. In the fifth window, accept the suggested names Student and Participate Subform and finish. The following first look of our form is shown.
Now edit the form in design view: Disable the StudentID-field. Adjust the length of some fields and labels if necessary. Do not display the PartCourseID but the course abbreviation. Open the properties of the field PartCourseID. Change the query to include not only Course.CourseID but also Course.CourseAbbr. Follow the subsequent steps from above (How to get rid of displayed keys in the form) by checking andif necessary editing the properties Bound Column (new value: probably 1), Column Count (new value: 2), Column Widths (new value e.g.: 0cm;3cm). Save the form and display it in form view (cf. Figure 20)
Adding a button for editing course information From the form that we created above, we also want to add new courses. We add a button to the Student-form that opens our previously created form Course from this Student-form window. Open the Student-form in design view. If not already open, open the floating window Toolbox from the menu View Toolbox. Choose a Command Button from the toolbox (the tool tips over the icons will tell you which is the command button). Draw the button on the form. Automatically, the command button wizard will open and help you configure the button.
Adding a button for editing course information In Categories, choose Form Operations. In Actions, choose Open Form. Click Next and identify the form (i.e. Course) that you want to open. Choose Open the form and display all records. Click Next. Choose an appropriate name or symbol for the button on the form. Click Next. Choose a name for the button widget. Click Finish. Save the form, open it in form view and check that the button works by opening the course form and adding a new course.
Adding a button for editing course information If you now try to assign students to the new course, you will note that the new course is not available in the Participate-subform! You must refresh the Student form before this is possible.
Simple Report In the Access main window, choose Reports. Click on Create report by using wizard. In the first wizard window, you have to choose which columns from which tables you want to display on your report (just as on a form). Choose the following columns: From table Course: CourseAbbr, CourseName From table Participate: PartYear, From table Student: StudentLastName, StudentFirstName Click Next. View data by Course. Click Next. Choose a second grouping level on the year the students to the course. Choose PartYear as an additional grouping level.
Simple Report Press on the > button to update the report preview on the right-hand side of the window (cf. Figure 21).
Simple Report Click Next. Order the students by last and first name. Click Next. Choose e.g. a Stepped lay out. Click Next. Choose e.g. Formal style. Click Next. Set or accept the name for the report, e.g. CourseReport. Click Finish. A report as in Figure 22 displays:
Simple Report You can now choose to open the report to make changes to the layout, e.g. choosing a different font or size for some fields, adjusting the lengths of fields, etc. The handling of a report layout is similar to the handling of format layouts.