Make exceptions to the rule with IF functions
Tip One pesky thing about designing a database is deciding how to handle exceptions to the rules. Suppose you want to send a mailing to customers that gives them an opportunity to receive a 10 per cent discount on orders they place in the next few weeks. This would be a simple project except that you have a few preferred customers to whom you would like to offer a discount of 20 per cent. There are a couple of approaches. You can design two mailing pieces from two different database reports -- one that shows a 10 per cent discount for regular customers and another that offers 20 per cent off to preferred accounts. This solution has two drawbacks: you have to include a filter in each report that selects the right customers, and you have to maintain two reports in the database. A better solution is to design a single report that uses an If function, which allows you to print a subset of data for each condition. In this case, it displays a discount percentage that depends on the contents of a flag field called Preferred in the Customer table. Access: embed an IIf() formula in your letter 1. Add a yes/no type field named Preferred to your Customer table. Then enter Yes in this field for any records for preferred customers. Approach: add a discount amount field to the letter As in the Access example, you need to add a field showing whether a customer is preferred. Open your Customer file, choose Create--Field Definition, and add a Boolean field called Preferred. Also add a Calculated field called Discount Amount. In the Formula box, enter If(Preferred,'20%','10%'), and then click OK. Add the Preferred field to the form you use to update customer records, and enter Yes for preferred customers. | Category: Data management Issue: May 1997 Pages: 170 |
These Web pages are produced by Australian PC World © 1997 IDG Communications