When you create records using a portal (see "Creating Portals" in Chapter 6, "Creating Relationships"), you may want to delete specific records (portal rows) in the other file. For example, if a customer cancels an order, you'll need to remove the entry from the sales database. Rather than going to the related file and searching for the record to delete, you can create a button to delete the record without leaving the first table.
1 .Go to the layout that contains the portal. Choose View > Layout Mode (Control+L/Command+L).
2 .Double-click the portal. When the Portal Setup dialog box appears, make sure that the "Allow deletion of portal records" box is checked (Figure 9.18). Click OK.
3 .
While in the portal, follow the steps in "To create a button for a script" earlier in this chapter, but in the Specify Button dialog box, scroll down to the Records section and choose Delete Portal Row (Figure 9.19). Do not check "Perform without dialog" because you want to be able to cancel the choice if you've made a mistake.
When you click the button, a dialog box appears. If you click Delete, the portal row and its related record will be deleted from the related table. If you click Cancel, it won' t be.
4 .At the flashing cursor, type X (the universal icon for Delete). To add emphasis, make the X bold (Figure 9.20).
5 .
Choose View > Browse Mode (Control+B/Command+B).
6 .Test the button by clicking it in any row that you want to delete. The warning dialog box will appear to confirm the deletion (Figure 9.21).
If the layout in which you put a button is one you use for printing, the button will print out too. To hide the button when you print, switch to Layout mode and select the button. Choose Format > Sliding/ Printing (Command+Option+T). In the Set Sliding/Printing dialog box, click the "Do not print the selected objects" check box and then OK (Figure 9.22). The button will appear on the layout but won't appear on printouts.
Add a series of buttons to a layout, either grouped vertically along the left side (Figure 9.23) or horizontally along the top (Figure 9.24), to create a button bar. Put this group of buttons in the layout you use most to speed up access to other layouts and scripts. You can put a button in those other layouts that switches back to the main layout.