Using Web Services in Access

While web services aren’t likely to factor into the tables at the heart of an Access database, they can be very useful in forms and reports. To demonstrate, the following example will use the Zip Code web service shown earlier as a way of filling in an address form without the user having to type in the city or state.

To get started, create a database, and then fire up the Microsoft Office Web Services Toolkit. The steps for generating code to work with a web service in Access are precisely the same as they were in Excel, so you can open the Visual Basic Editor and follow the same steps to create a web service wrapper associated with the WSDL file http://webservicex.net/uszip.asmx?WSDL. Once you have created that wrapper, make a table containing basic address information, like the address table shown in Figure 9-19.

The address table that forms the base of the example

Figure 9-19. The address table that forms the base of the example

A basic form, created using the Form Wizard’s “columnar” option, provides users (and the web service) with access to the information in the table. The design of the form is shown in Figure 9-20.

The form that will host the web service, shown just before the After Update event is triggered

Figure 9-20. The form that will host the web service, shown just before the After Update event is triggered

For my own convenience, I’ve set the Auto Tab property of the City, State, and AreaCode ...

Get Office 2003 XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.