Show a different image per record on a data access page in Access

Applies to
Microsoft Access 2000

In Access 2000, you can create Web pages that you can use to add, edit, view, or manipulate the data stored in a database. These Web pages are called data access pages.

You can use an image control to display a different picture for each record on a data access page - for example, if you want to show a picture of each product in your catalog. First you create a Text field in the underlying table where you store the Uniform Resource Locators (URLs) of your pictures, then you add the image control to the page.

Create a Text Field for the URLs of Your Pictures

In forms and reports, you can display a different picture for each record by storing the pictures in an OLE Object field in the underlying table. In a data access page, you cannot do this. However, you can create a Text field in the page's underlying table and add to it the URLs of the pictures you want to display. Use the Text data type, not the Hyperlink data type, for the field where you store the URLs.

You can display pictures that are stored on a Web server, a network server, or a local computer. The following addresses show the syntax of some URLs you could use to display pictures on a page:

  • http: //WebServerName/FileName.jpg
  • file:///\\NetworkServerName\ShareName\FileName.jpg
  • file:///c:\LocalFolderName\FileName.jpg

 Note   The URLs can point to other types of picture files, such as *.gif files or *.bmp files.

Add the Image Control to the Data Access Page

After you create the Text field in the page's underlying table and enter the URLs of your pictures, add an image control to the page.

To add an image control to a data access page

  1. Open the data access page in Design view.
  2. In the toolbox, click the Image tool.
  3. On the page, click where you want to place the picture.
  4. In the Insert Picture dialog box, select any picture file - such as a *.bmp, *.gif, or *.jpg file - or type the URL of a picture in the File Name box. Then click OK.

 Note    It does not matter which picture file you select, but if you do not select a file, the image control is not inserted in the page.

  1. Right-click the image control, click Properties, and then click the Data tab.
  2. In the ControlSource property box, click the field where the URLs of the pictures are stored.

Now if you look at your data access page in Page view and scroll through the records, a different picture for each record appears in the image control. Each picture corresponds to the URL you typed in that record's Text field in the underlying table.

For more information about data access pages, type data access page in the Office Assistant or on the Answer Wizard tab in the Help window, and then click Search.