Creating Data Access Pages Using the OutputTo Method

The following code uses the OutputTo method to export the tblComplaints table created earlier to a data access page.

DoCmd.OutputTo acOutputTable, "tblComplaints", acFormatDAP, "c: \temp\complaintsDAP.html"

Note that the page is being saved in an HTML format. Data access pages are saved in an HTML format but contain additional code that connects to the Access or SQL Server database for retrieving and modifying the data. Do not confuse this with the static HTML document that you created in one of the prior examples. The complaintsDAP.html file created from the preceding code looks similar to the screen shown in Figure 8.7.

tblComplaints - Microsaft Internet Explorer provided by Woodard, Emhardt, Moriarty, LLP

- im

File Edit View Favorites Tools Help

4

F

'S Back

O 0 ® 3

Search Favorites ^jf Media

0 m * U fift

»

Address @ C:\Temp\complaints.htaril

-

H Go Links

»

Google^-

E

(J5S Search Web fj

iÇfa 249 blocked

AutoFill 0

Options

J*

Complalntld ComplaintDate CustomerName CustomerDayP CustomerEveni IssueDescriptlon

Resolved

Resolution Degi

1 4/23/2004

John Doe

501-723-1111

501-723-2222

Leaky faucet

No

2 4/23/2004

Jack Smith

987-G 54-3211

987-654-3211

Storm door that will not shut

No

3 4/24/2004

Betty Doe

111-222-3333

111-222-3333

Neighbor in other apartment has loud parties

No

4 4/25/2004

Amber Smith

999-888-7777

999-888-4444

Stove in kitchen not work™

No

I4 i

tblComplaints 1-4 of 4

► H ► KK y

V 0|

m

Done

2 My Computer

Figure 8.7

The data in Figure 8.7 can be edited within the grid. The data can be further manipulated using the buttons along the bottom; they enable you to add new records and navigate among the records. As you will see momentarily, data access pages can also resemble the look and feel of a traditional form, whereas the example in Figure 8.7 more closely resembles a datasheet form.

0 0

Post a comment