Fax reports from Access


Tip
If you want to fax an Access report, you can print the report, trot over to the fax machine and send it. Or you can remain seated and fax the report directly from Access. All you need is a fax modem, the Microsoft Exchange e-mail client, and Microsoft Fax or Symantec's WinFax Pro. In the examples here, we'll use Microsoft Fax. To see how this technique works with either program, download rptsampl.exe from ftp://ftp.microsoft.com/softlib/mslfiles.
If you routinely fax a particular report to one person, you can create a simple macro that records that person's phone number and the name of the report you want to send. Here's how:
1. In the Database window, click the Macros tab and then New.
2. Choose SendObject from the Action drop-down list. In the bottom half of the macro builder dialogue box, set Object Type to Report, set Object Name to the name of the report you want to fax, set Output Format to Rich Text Format, and enter fax: ###-#### after 'To:' where ###-#### is the number you want to fax to.
3. Close the macro and save it as Fax Report, or whatever you like.
4. To fax the report, click the Macros tab in the Database window, select Fax Report, then click the Run button.
A slightly more complex procedure allows you to send a fax to several different numbers. In the example below, we'll create a report to remind selected individuals of an upcoming meeting. The date and purpose of the meeting will vary with each individual.
1. Create a query to select the people you want to receive the report.

Figure 6: The Query selects people from the Meetings table who are scheduled for meetings in the next week. The Meetings table is joined to the addresses in the Clients table

2. Create a design for the report.
3. With the report in design view, right-click the box in the upper-left corner of the report window and choose Properties. Click the Event tab, select [Event Procedure] from the drop-down menu for On Open, and click the ... at the end of the line. Then enter Me.Filter=strFaxWhere in the window that opens. Close the code window, close the report, and save it. This step tells Access to print only records in which ClientID is the same as the value stored in the variable strFaxWhere.
4. Click the Module tab in the Database window, then click New. Under "Option Explicit", type the lines shown in Figure 1:



Figure 1


When you're finished, close the Module window and save it as FaxReports.
5. Create a macro to fax the reports: click the Macros tab in the Database window, then click New. Select RunCode from the Action list, and enter FaxReminders() in the Function Name box. Save the macro as Fax Meeting Reminders.
6. To fax the reminders, highlight Fax Meeting Reminders on the Macros tab in the Database window and click Run. Choose a profile if you're prompted, and click OK.
You'll have to make some changes to the code to make it work with your database:
· In the first "Dim" statement, replace "Meetings" (in the expression "dbsMeetings") with the name of your database.
· Replace the term "Reminders" with the name of the query your report is based on.
· Replace the term "Clients.ClientID" with the name of your client code or customer number field.
· Replace "Client Meeting Reminders" with the name of your report.
· Replace the term "Fax" in ![Fax] with the name of the field that contains your fax numbers.
· In this example, ClientID is an AutoNumber field. If you're using a text field to select records, change the line under "Do Until..." to read: strFaxWhere = "Clients.ClientID = '" & ![Clients.ClientID] & "'". Include a space followed by an underscore at the end of any line you break.
- Celeste Robinson

Category: Data management
Issue: Sep 1997
Pages: 173-174

These Web pages are produced by Australian PC World © 1997 IDG Communications