Microsoft KB Archive/263021

= ACC2000: How to Display Images in a Data Access Page =

Article ID: 263021

Article Last Modified on 7/13/2004

-

APPLIES TO


 * Microsoft Access 2000 Standard Edition

-



This article was previously published under Q263021



Advanced: Requires expert coding, interoperability, and multiuser skills.

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).



SUMMARY
Sometimes, you may not want to store images in a Microsoft Access table. You may not want to do this if you have many images, or if each of your image files is large. Image files can increase the size of an Access database quickly.

This article shows you an example of how to display images on a data access page in such a way that only the path and file name are stored in a Microsoft Access table.



MORE INFORMATION
 Open any Access 2000 database.  Create the following table:   Table: tblTest Field Name: ID  Data Type: AutoNumber Indexed: Yes (No Duplicates)

Field Name: Caption Data Type: Text

Field Name: ImageURL Date Type: Text Table Properties: tblTest -  PrimaryKey: ID                     Put a few image files into a folder on your computer.  Open the tblTest table in Datasheet view. Then, add the URL of each image file to a new record. The following example shows how the records might look:   ID:   Caption:      ImageURL: 1    Picture1      http://machinename/images/image1.jpg 2    Picture2      http://machinename/images/image2.jpg 3    Picture3      http://machinename/images/image3.bmp  Create a new data access page. Base it on the tblTest table. Add the ID and Caption fields to the new data access page.</li> Add the field ImageURL to the data access page. Delete its associated label. Then, set its Visibility property to hidden.</li> Add an Image control. In the Insert Image dialog box, click your first image, and then click OK.</li>  Set the properties of the Image control as follows: <pre class="fixed_text">   ID:  Image0 Src: http://machinename/images/image1.jpg </li> On the Tools menu, point to Macro, and then click Microsoft Script Editor.</li>  Type or paste the following code: <SCRIPT event=Current(x) for=MSODSC language=vbscript>

</SCRIPT> </li> Save the changes, and then close the Script Editor. Save the page, and then open it in a Web browser.</li></ol>

Keywords: kbhowto kbdap kbdapscript KB263021

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.