Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 263021 - Last Review: July 13, 2004 - Revision: 1.1
ACC2000: How to Display Images in a Data Access Page
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).
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.
- 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.
- Add the field ImageURL to the data access page. Delete its associated label. Then, set its Visibility property to hidden.
- Add an Image control. In the Insert Image dialog box, click your first image, and then click OK.
- Set the properties of the Image control as follows:
ID: Image0
Src: http://machinename/images/image1.jpg
- On the Tools menu, point to Macro, and then click Microsoft Script Editor.
- Type or paste the following code:
<SCRIPT event=Current(x) for=MSODSC language=vbscript>
<!--
Image0.src=ImageURL.value
-->
</SCRIPT>
- Save the changes, and then close the Script Editor. Save the page, and then open it in a Web browser.
APPLIES TO
- Microsoft Access 2000 Standard Edition
| kbhowto kbdap kbdapscript KB263021 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate