|
![]()
Creating an Access Database - Step 4: The Forms - The Track FormThis form differs slightly from the other forms in the database in that it is a sub-form, i.e. it doesn't get displayed by itself, but only within the record form. Create a new form in design mode and set the following properties for the form:
Now we can start adding controls to the Detail section of the form. All of the controls on this form are going to be text boxes, so the quickest way to add them all is to view the field list, and then select all of fields shown apart from TrackID and RecordID, and drag them to the form's detail section. Remove all of the labels that were created with the text boxes (Ctl-X to cut them, and then you can paste them straight into the form's header). In the order that the controls are going to appear on the form, we need to make the following changes: TrackNumber
TrackName
TrackMinutes
TrackSeconds
TrackAuthor
TrackNotes
Now move the controls from their original placings on the form so that they are now aligned vertically about 0.1cm below the top of the Detail section, and resize the Detail so that there is a space of about 0.1cm under the text boxes. Add a label to the detail, and set the caption to ":", and place this between txtTrackMinutes and txtTrackSeconds. Next, we shall add two text boxes to the form footer, to display the total
time for the record. Call the text boxes "txtTotalMinutes" and "txtTotalSeconds".
As these are both calculated controls, we need to distinguish them from other
controls, so we set the following properties for them:
We shall set the ControlSource of txtTotalMinutes to: =Sum([TrackMinutes])+(Sum([TrackSeconds])\60) and that of txtTotalSeconds to: =(Sum([TrackSeconds]) Mod 60) Now we need to add a few bits of code to the form to update the record's total time, and to ensure that if the calculated controls get the entered, we move to another field:
Copyright & Disclaimer | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Last modified at 06/06/2006 15:01:45 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||