APPLICATION DESIGN
To create a subform
You can copy and modify a subform that is similar to the one you need or create a new subform and design it yourself.
1. Open the database that will have the new subform and click Shared Code - Subforms.
2. Click "New Subform."
3. Create the subform using the same elements you use to create a form.
4. Choose Design - Subform Properties. The Subform Properties box appears.
5. At the Subform Info tab, enter a name for the new subform.
6. Optionally, you can enter a comment.
7. Choose from the following options for displaying the subform:
If you do not check this setting, field names are saved to a table and then stored in memory. Storing field names in memory allows field names to appear in places such as the "Add Action" dialog box.
To insert a subform on a form
1. Open a form.
2. Place the cursor where you want to paste the subform.
3. Choose Create - Resource - Insert Subform. The Insert Subform dialog box appears.
4. Select the subform you want and click OK. You can also insert subforms contained in other databases by selecting a database listed in the Database pull-down list.
To display a computed subform on a form
3. Choose Create - Resource - Insert Subform.
4. Select "Insert Subform based on formula."
5. Click OK.
6. Enter a formula in the Programmer's pane that determines which subform to display.
7. Close, name, and save the form.
Example of displaying a computed subform
In the Main Topic form of a discussion database, you want to display the NewDocSubform when a document is created and the SavedDocSubform when a saved document is opened. Each subform contains different fields and graphics. The Insert Subform formula is:
@If(@IsNewDoc;"NewDocSubform";"SavedDocSubform");
Note Subform formulas cannot be refreshed while the document is open.
Deleting subforms
When a user opens a document that references a deleted subform, the message "Subform: <subform name> not loaded" appears on the status bar. The document opens without any representation of the deleted subform. When a designer opens a form that references a deleted subform, the message "Subform: <subform name> not loaded" appears on the status bar. When a designer clicks the deleted subform area on the form, the message "Invalid or nonexistent document" appears and the designer can't open the subform.
To avoid these messages, add another subform to the database and give it the same name as the deleted one.
To delete a subform from a form
You can remove a subform from an individual form, without disturbing other forms that use it.
1. Click the subform area on a form.
2. Choose Edit - Delete.
3. Adjust the formatting if necessary.
To delete a subform from a database
You can remove all instances of a subform from a database. Be aware that this will cause errors in any form that refers to the subform.
1. Click Subforms in the design list for the database.