vb123.com

Garry Robinson's Popular MS Access, Office and VB Resource Site

 

Home  Contact Us

Order Software

Search vb123

 Smart Access  
The Magazine that Access Developers loved to read and write for is back
Article Index Here or
Purchase Here

RSS & Newsletter  
Join our XML/RSS Newsfeed or sign up for our informative newsletter on Office Automation, Access and VB topics
Sign up here

Get Good Help
If you need help with a database, our Australian Professionals could be the answer
Read More

123 For Office

Great shortcuts, supports Office 2013 to 2003, easy zipping.
Read More

  The Workbench  Find out who has your database open, start the correct version of Access, easy compacting and zip backups, change startup options,  compile, shutdown database
Read and Download


Access > SqlServer 
Upsize to SQL Server 2005 or 2008, easily repeated conversions, highly accurate SQL query
translation and web form conversion.
Read More

Like FMS Products?
Purchase them from us and get a free Workbench or Smart Access  More

Garry's Blog
Find out a few other things that Garry has been writing about Microsoft Access. Read more

About The Editor Garry Robinson writes for a number of popular computer magazines, is now a book author and has worked on 100+ Access databases. He is based in Sydney, Australia
Contact Us ...


 

 

Next Tip  External Verses Internal Database Images  

Following is a email discussion on what to do about displaying external images in a Access database.  Quite handy especially if you are thinking of moving your database to the web where internal bitmap images are useless.

See this page for a sample of
External Database Images in a report

I hope  you can help me.  I've been trying to insert .jpg photographs into an OLE field, but no matter what I try all I get in the field is an icon.  How can I get Access to actually display the .jpg photograph on a form?   The only solution I've found so far is insert a Microsoft Word Picture and inserting the .Jpg into it.  Microsoft word accepts the .jpg, but Access does not seem to.

 Here is the article to get you going and if you get it going either let me know how or drop a tip onto our help hoops.

_________________________________________________

Thanks a lot for your help.  The article you sent me was exactly what I needed, with the added benefit that the images are not stored in the data base.  The instructions in the article were very detailed and it worked like a charm.   

And The Knowledge Based Article Is

---------------------------------------------------------------------

The information in this article applies to: - Microsoft Access versions 2.0, 7.0, 97

SUMMARY

Advanced: Requires expert coding, interoperability, and multi-user skills.

This article describes how you can display bitmap images on a form with only the path and file name stored in the Microsoft Access table.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the

"Building Applications with Microsoft Access" manual.

NOTE: Visual Basic for Applications is called Access Basic in Microsoft Access version 2.0. For more information about Access Basic, please refer to the "Building Applications" manual.

MORE INFORMATION

================

Sometimes it is not practical to store images in a Microsoft Access table. If you have a large number of images, or if each of your image files is large, the size of the Microsoft Access database file can rapidly increase.

 

The following examples demonstrate how to display Windows bitmap images on a Microsoft Access form without storing the images in a Microsoft Access table.

In Microsoft Access 97 and 7.0

------------------------------

 

1. Open the sample database Northwind.mdb.

2. Create an new table named Imagetable and add a text field named ImagePath.

3. Open the Imagetable table in Datasheet view and add the path and name of a bitmap file to each record. The following examples show how the records might look:

     c:\windows\circles.bmp

      C:\windows\waves.bmp

      c:\windows\tiles.bmp

      c:\windows\bubbles.bmp

4. Create a new form based on the ImageTable table using the Autoform

   Columnar Wizard. Name the form Imageform.

5. Open the Imageform form in Design view and add an image using the Image tool on the toolbox. You will be prompted to select an image to insert. Select any image available on your computer. Name the control ImageFrame.

6. Set the Imageform form's OnCurrent property to the following [Event Procedure]:

      Private Sub Form_Current()

         On Error Resume Next

         Me![ImageFrame].Picture = Me![ImagePath]

      End Sub

 

7. Set the ImagePath text box's AfterUpdate property to the following   [Event Procedure]:

      Private Sub Form_AfterUpdate()

         On Error Resume Next

         Me![ImageFrame].Picture = Me![ImagePath]

      End Sub

8. Open the Imageform form in Form view. Note that the form displays the corresponding bitmap for each record.

In Microsoft Access 2.0

1. Open the sample database NWIND.MDB.

2. Create an new table named Imagetable and add a text field named   ImagePath.

3. Open the Imagetable table in Datasheet view and add the path and name of a bitmap file to each record. The following examples show how the records might look:

      c:\windows\circles.bmp

      C:\windows\waves.bmp

      c:\windows\tiles.bmp

      c:\windows\bubbles.bmp

4. Create a new form based on the ImageTable table using the AutoForm Wizard. Name the form Imageform.

5. Open the Imageform form in Design view and add an unbound object frame using the Unbound Object Frame tool on the toolbox. Name the control ImageFrame.

6. Set the Imageform form's OnCurrent property to the following [Event Procedure]:

      Private Sub Form_Current()

         On Error Resume Next

         If Not IsNull(Me![ImagePath]) Then

         Me![ImageFrame].OLETypeAllowed = 1

         Me![ImageFrame].SourceDoc = Me![Imagepath]

         Me![ImageFrame].Action = 0

         End If

      End Sub

 

7. Set the ImagePath text box's AfterUpdate property to the following  [Event Procedure]:

      Sub ImagePath_AfterUpdate ()

         On Error Resume Next

         Me![ImageFrame].OLETypeAllowed = 1

         Me![ImageFrame].SourceDoc = Me![Imagepath]

         Me![ImageFrame].Action = 0

      End Sub

8. Set the following properties for the ImageFrame unbound object frame:

       Enabled: Yes

       Locked: No

 

9. Open the Imageform in Form view. Note that the form displays the corresponding bitmap for each record.

NOTE: In Microsoft Access 97 and 7.0, the form will not display any image if an invalid path or file name is added to the ImageTable table. However, error trapping can be implemented to a further degree to ensure a valid path and file name are entered. In Microsoft Access 2.0, the form will just ignore the error and display the most recent bitmap on the form.

REFERENCES

For more information about the OleTypeAllowed property, search the Help Index for "OleTypeAllowed," and then "OleTypeAllowed Property," or ask the Microsoft Access 97 Office Assistant.

For more information about the Sourcedoc property, search the Help Index for "Sourcedoc," and then "SourceDoc Property," or ask the Microsoft Access 97 Office Assistant.

KBCategory: kbole kbhowto

KBSubcategory: IntpOle

Additional reference words: 7.00 97

Copyright (c) Microsoft Corporation.

There was a MS Knowledgebase article that relates to the topic.  If you do not have the free knowledge base from MS, goto to Microsoft FreeStuff

and see how to find it.

 

Data Mining ? http://www.gr-fx.com/graf/reviews.htm

 

Links >>>  Home | Search | Workbench | Orders | Newsletter | Access Security | Access professionals