Steps to create forms in the student database:
- First I opened the student database
- I want to first create a form template that I can uses as a basis for other forms, so…
- I selected Forms and then either selected create form in design view or selected New and then Design View
- I want to be able to have headers, footers as well as detail (if headers and footers are not on the form use View followed by Form Header/Footer)
- I then positioned the form by extending the size on the bottom and the top. I can also change the amount of room for sections by clicking on the divider and dragging - I want to put an image in the header so I am going to need more room on the form header.
- To change the properties of the form, you can either use the properties button or you can write click to bring up properties. If you are clear on the property category, you can select that - otherwise select all. If I want to show multiple records on a form I would need to have Record selectors and Dividing Lines set to Yes - if I am looking for only one, I should set these to NO.
- I can also change the properties of this form and set the font size and color to a something particular for text that is entered for labels that are created etc. One of the things that is interesting to change is the position of the data. By default the label for the field comes in on the left and the field with the data comes in on the right. You can change the Label X and Label Y to get the form delivered above and you can align the label and the text as well. For example you could set Label X to 0 and Label Y to -.25 and then the alignments both to Left. If you want to get rid of the colons you can also change the add colon property.
- Since I am creating a template I decided to call it by a template name - I want the template names to appear at the bottom so I named them with a leading z to push to the bottom. This one is named ztempt1 for lack of originality - in fact a more meaningful name should be used. I am not done creating the template but I am saving for security. In fact, I save about every ten minutes just to be sure…
- Now I want to put a picture on the form so I go to the toolbox and select the image button. I bring the image to the form - I put it in the top left in the header area. When you drag the image over, you will see the Insert Picture dialog box which allows you to pick an image. I used a gif image that I had created originally using word art. I stretched and shaped the area to accommodate the image size. (Actually before doing this I went into Microsoft Photo Editor and sized the image the way I wanted it).
- I then went in and put the labels I wanted on using the label from the toolbox. Note I did some sizing and shaping there to get it to wrap correctly to the second line and I used the properties window to effect the look. I then saved again.
- Note: To make this form the default you can go to Tools and then Options followed by Forms/Report and enter the name of the new form in the Form template field in place of Normal. Now when you go to create a new form it will use this template.
- Now that I have a template, I can click on it and then COPY and PASTE and give it a name through the Paste. This will create a new form using the template.
- To see the properties on the form you can click on the property button on the form design toolbar, right click to bring it up.
- First I want to use the data on the student00 table within the database. To do this, I used View/Field List (there is also a field list icon). You can then position the fields as you want on the form. I brought over three fields: student idno, name, and enrolled. I then went in and changed the name and the caption for each of these fields. I called the names lblStuIdno etc. The lbl tells me that this is a label. I also went in and set up a student major field. The code behind this field checked the student major code and displayed a major name based on the code. This was done with an IIF statement: =IIf([majorcode]="PR","Programming Career",IIf([majorcode]="NT","Networking Career",IIf([majorcode]="MI","Multimedia and the Interent Career",IIf([majorcode]="WB","Webmaster Career",IIf([majorcode]="MB","Microcomputers in Business Career",IIf([majorcode]="IT","Information Systems Transfer","No major selected"))))))
- I then decided that I wanted to list the courses that the student was taking. This time I clicked on Form and then New. When the screen where I select Design View came up, I also selected the table that I wanted to use which was stucourse00.
- First I designed the form and then I changed the default from single to continuous forms.
Now I need to go back into the main form and make the connection between the main form and the subform - note that the subform is saved separately as Stucrsesub.
First I go to the tool bar and select the option that says Subform/Subreport.
Then I bring it over to the form and locate it in the area where I want it to show.
Then I bring up the properties so that I can provide the link between the two tables. Since the tables in this database have primary keys and a relationship has been established, this is fairly straightforward.