Presentation on theme: "AS ICT Building a complex multi-table form. Introduction In addition to the single table form and sub-form design wizard available in earlier versions,"— Presentation transcript:
AS ICT Building a complex multi-table form
Introduction In addition to the single table form and sub-form design wizard available in earlier versions, MS-Access 2007 incorporates many automated procedures which help in building multi-table forms. As shown in presentation 3.2, these tools are grouped by type of procedure in different ribbons, which are accessed by clicking the appropriate Menu Bar tab. It is therefore necessary to be familiar with the contents of these ribbons to find and select the appropriate tool for performing the task in hand. This presentation shows how to create an Order Process Form which accesses data held in 4 related database tables and performs calculations on data fields held in two separate tables. However, before starting this task, it will only be successful when all table relationships have been created using referential integrity checks where appropriate. When relationships and appropriate referential integrity is in place then it is possible to create forms which access, link and display data from related tables. Furthermore, this may be achieved without having to resort to using the Query Design Builder, writing SQL macros or using the MS Visual Basic object programming interface to write VBA programs that can grab data from any database table field, store then in VBA variable then manipulate and display them to your requirements. The only need for these techniques is when you wish to extract ad hoc data from unrelated tables, or to perform and display results of calculations on data held in the database.
Preparation The invoice normalisation activity performed earlier as a paper based database design activity forms the foundations for creating well designed database tables. – Refer to earlier presentations on creating these tables and specifying table fields When these tables have been created, relationships between tables should be defined which closely match the Entity Relationship Diagram (ERD) also developed as a paper based design activity. – Refer to earlier presentations on creating database table Relationships Examination of the Relationships Report identifies the tables at the “1” end of the “1 to many” relationships with no links to intermediate tables which may be used for creating simple one table forms The Relationships Report on the next screen identifies these tables.
Examining the Relationships Report The Customer and Product Tables, both circled in red, are suitable candidates for creating simple forms because they are both at the “1” end of “1 to many” relationships and are only related to one other table (at the “many” end of the relationship)
Creating Customer & Product Forms 1.Click on the Customer: Table object to highlight this table 2.Open the Create ribbon and click on the Form button to automatically create a Customer Form as shown below 3.Because the Customer Table is related to the Invoice Table, an Invoice sub form will also be created for entering invoice details, which is not required for maintaining Customer details. 4.This can be deleted by clicking on the edge of the sub form, which outlines the object with an orange line. 5.Press the keyboard Delete button to remove this object. 6.Right click on the Customer tab at the top of the form and select Save from the drop down menu. 7.Enter an appropriate name for the Form, e.g. CustomerDetailsFrm, in the Save As window (cf. right) 8.Click on the OK button to save the Form Repeat the above procedure by first selecting the Product: Table to create and name a ProductDetailsFrm