Using the Num Word function

For the sake of example, assume that you already put NumWord() into a standard module in your database. You already have a table that contains data to be printed on checks. Just to give this whole example some context, suppose that you have a table with field names and data types similar to those shown in the sample Payables table in Figure 11-6. The top-left side of the figure shows the table's structure, and the bottom-right side of the figure shows some sample data in the table.

Figure 11-6:

Sample field names and data types for printing checks.

Figure 11-6:

Sample field names and data types for printing checks.

Next, you need to create a report format for printing on the checks. When you get to the part of the report where the check amount needs to be printed, just add a calculated control that prints the NumWord of the numeric check amount. For example, in the PrintChecks report shown in Figure 11-7, you can see where we placed various controls to line up with blanks on each check (even though we don't really have a preprinted check here to show you). Presumably, all the other info the check needs is already printed on the check.

Figure 11-7:

Sample report format for printing checks.

Figure 11-7:

Sample report format for printing checks.

In the report format shown in Figure 11-7, the PayTo and CheckAmt fields come straight from the underlying Payables table. The check date and check amount in words are both calculated controls. The calculated control for printing the check date has as its Control Source property the expression =Date(), which prints the current date on the check. The calculated control for printing the check amount in words contains this expression as its Control Source property:

=NumWord([CheckAmt])

There, the field name CheckAmt refers to the field named CheckAmt, which contains the check amount expressed as a number. Once again, the example illustrates how after you add a custom function to a standard module, you can use that function anywhere that you would use a built-in function. For example, the check date is printed by using the built-in Date() function, and the check amount (in words) is printed by the custom NumWord() function.

Figure 11-8 shows a print preview for the report in Figure 11-7 (with some dashed lines artificially thrown in to make it easier to see where each check begins and ends). As mentioned, we assume that any other information that needs to be printed on the check is already on the checks.

Figure 11-8:

Print preview of a sample check-printing report.

Figure 11-8 shows a print preview for the report in Figure 11-7 (with some dashed lines artificially thrown in to make it easier to see where each check begins and ends). As mentioned, we assume that any other information that needs to be printed on the check is already on the checks.

Was this article helpful?

0 0

Post a comment