Forms come in a lot of varieties in Microsoft Access. One of the majority general forms to employ is a sub form. Usually a sub form has a grid like look and is used to show more than one record.

Sometimes a Microsoft access sub form could be used beside a chief form to model what is known as a one to much relationship for instance an invoicing structure where one client can have a lot of commands. We would put up a table for clients and one for commands. We would then make the link between the two tables to illustrate that for each client there is one order and every order could belong to only one client. The link in the relationship would be the client ID which could be the main key of the one side (customer) table and a lot of side (orders) table.

Nowadays that we have the relationship in place it is time to make the forms. Since we have a one too various relationship, it makes sense to illustrate a major form having one client and a sub form presenting all their orders. If you are making use of Access 2007 making a chief and sub form situation is extremely simple offering you have the table relationship in place. This is as simple as clicking one key. In earlier versions of MS Access though you would have to make a main form first and then choose the Microsoft Access sub form in the controls toolbox. You would then drag and drop this sub form to a clear area of the chief form.

Both the major and sub form must have a record source as also a table or inquiry. In this situation you would bind the client table as the record source of the key form and bind the commands table as the record source of the sub form.

To link the sub form to the main form you would go into form design view and right click the sub form to bring up the properties window.

The properties to be put are the ‘Link Master Fields and ‘Linking fields. This means we have to give the table connecting ID value in both these properties to create the link among the major and the sub form. In this situation the client ID is the joining field and it will be entered in the child properties and link master.

Author writes for access 2007, microsoft access and access database


Top Popular Products: