Access07: Hire Co : Hire Form
|MS Access <|
|Table of contents|
In order to create a form that allows the hire details to be added for a client, the main form needs to be based on the client (tblClient), and the sub-form on the Hire plus related Equipment data.
This is achieved by linking the Client table to the Hire x Equipment query created in an earlier task.
It is good practice to only link two tables or one table and a query, rather than let Access try and figure out the multiple relationships.
1. Create > More forms > Form Wizard
2. Choose tblClient and select all data [>>]
3. Choose qryHirexEquip and select all data [>>]
5. leave the view by tblClient, [Next]
6. Leave the subform default as a datasheet
7. Choose any style (I am using Windows Vista), [Next]
8. For the titles
- Form: frmClientHire
- SubForm :sfrClientHire
The following form should be created (You will need to adjust the column widths in the subform for all fields to show)
Edit the form/Subform
From a user perspective there are some fields in the sub form which should not be displayed or should be displayed but should not be able to be changed
- The Client ID (ClID) is automatically created from the main form so does not need to show
- Apart from EquID, all of the fields coming from the equipment table should be disabled (should not be editable)
In display view shrink the CLID column until it disappears
To change the properties of the fields on the SubForm, in design view - if the properties sheet is not displayed - right click on the field you want to change (select properties)
- For EquLDsn and the EquHireCharge change the Enabled property (use Data tab) to No (the field should become greyed out)