Re: Picture property for Access 2K forms

From: Chris Mills (phad_nospam_at_cleardotnet.nz)
Date: 05/25/04

  • Next message: Barry Stephens (Microsoft): "RE: Access 2002 SP3 Runtime error!!"
    Date: Tue, 25 May 2004 12:55:31 +1200
    
    

    I don't use Office Filters, or any other unnecessary extensions. I avoid them
    like the plague. Must be something I read about compatibility when
    distributing an app.

    I've never missed them, either. If necessary, I just wrote code or something.

    HTH
    Chris

    "Chuck" <chuck@serverking.net> wrote in message
    news:Ztvsc.8876$be.2622@newsread2.news.pas.earthlink.net...
    > Thanks, Chris
    > You're right - the form picture property doesn't "stick",probably becasue
    > I'm using an instance of a form, not the form itself. The real issue is that
    > these Office filter (.flt) apps from Microsoft uselessly generate a progress
    > indicator on the Access workspace as they import the image - that's what I'm
    > trying to eliminate. Any ideas on that (probably not possible, but I thought
    > I'd ask...)
    >
    > Thanks in advance.
    >
    > Chuck
    >
    > "Chris Mills" <phad_nospam@cleardotnet.nz> wrote in message
    > news:ei8IEcTQEHA.2404@TK2MSFTNGP12.phx.gbl...
    > > > My app has the option to dynamically change the picture property for a
    > form
    > > > (using a file selection dialog to select an image (.JPG) file from
    > anywhere
    > > > on disk. I need to use .JPG files (.BMPs are too large).
    > >
    > > I think you will have more "issues" than that.
    > >
    > > 1) JPG files are not necessarily smaller that BMP's, whether embedded or
    > even
    > > LINKED by in-built methods. This is because, Access insists on storing a
    > bmp
    > > image of any image file anyway. I presume Access does this for efficiency
    > or
    > > speed, and it works great...until you look at the database size involved.
    > >
    > > 2) Depending on how you do it, dynamically changing an image may or may
    > not
    > > "stick", however this is a red herring and I don't have details to hand
    > merely
    > > a bad experience.
    > >
    > > A realistic Imaging approach, involves avoiding Access in-built imaging. I
    > > guess there are several approaches:
    > > -Search for posts mentioning www.lebans.com, an acknowledged expert on
    > > imaging.
    > > -Heres a reprint of a post I've used with some success.
    > >
    > > I used this after a client grew to maximum size within weeks :-)
    > > Chris
    > >
    > >
    > > ----- Original Message -----
    > > From: "Frank Miller" <Frank-NoSpam-Miller@microsoft.com>
    > > Newsgroups: microsoft.public.access.developers.toolkitode
    > > Sent: Tuesday, November 13, 2001 11:04 AM
    > > Subject: RE: Catalog Application - Picture Handling
    > >
    > > Hi Beau,
    > >
    > > My name is Frank Miller. Thank you for using the Microsoft Access
    > > Newsgroups.
    > >
    > > There are primary two ways to get images onto an Access 97 form or report,
    > > either we embed the images in the database or we create links in the
    > > database to the image files.
    > >
    > > The embed method is easier to distribute but creates a much larger
    > database
    > > file.
    > >
    > > The link method saves considerable space in the database but requires that
    > > the path is valid at the time the image is displayed.
    > >
    > > Thumbnail images can also be utilized by including a second, smaller
    > > version of each image, or by simply scaling down the image display in the
    > > form or report.
    > >
    > > In the following example, a form is used to load and display images, a
    > > report is used that will print both the embedded and linked images, and a
    > > database table is created that contains both embedded and a linked JPG
    > > images. Although JPG images were used in this example, other image types
    > > can also be used.
    > >
    > > On a Windows 98 platform, the database table uses a Text field to store
    > the
    > > image link and an OLE Object field to store the embedded image.
    > >
    > > First we create a database that contains, as a minimum, a text field which
    > > is the source for the image link and a OLE Object field which is where the
    > > embedded image is stored.
    > >
    > > Next, we create a Form that will both link, embed, and display both types
    > > of the selected image file. On the form we need a Common Dialog ActiveX
    > > control (named ActiveXCtl3 in the example below) to get the image path, a
    > > Command Button (named Load New Image) to get new images, a Text box (named
    > > Text2) to display the image file path, an Image box (named Image4) to
    > > display the linked image, and a Bound Object Frame (named OLEBound10),
    > that
    > > is bound to the embedded image in the database.
    > > Sample code:
    > >
    > > The routine below is good for loading OLE objects, such as .gif, .jpg,
    > > doc, .xls, or .bmp files that are associated with an OLE Server, into a
    > > Microsoft Access database. We can set the Image control's Picture Property
    > > to any .bmp, .ico, .wmf, .dib, or .emf file on your hard disk. If you have
    > > installed graphics filters for other programs, you can use any file
    > > supported by those filters (such as TIF files).
    > >
    > > NOTE: To associate a graphic file with an OLE Server, open it with an OLE
    > > Server package, such as Microsoft Imager or Microsoft Paint, and save the
    > > file.
    > >
    > > If you receive an error opening the image, please see article:
    > >
    > > Q294255 - ACC2000: Err Msg When You Attempt to Display Images on a Form
    > >
    > > http://support.microsoft.com/support/kb/articles/q294/2/55.asp
    > >
    > > The following subroutine loads the linked image to the form when the form
    > > opens and when the user selects a new record in the database. The On Error
    > > Resume Next is used to avoid an error message when there is no link or
    > when
    > > the link does not point to a valid image file.
    > >
    > > Private Sub Form_Current()
    > > On Error Resume Next
    > > Me.Image4.Picture = Me.Text2
    > > End Sub
    > >
    > > This subrountine runs when the Load New Image button is clicked. It
    > > displays the Open File dialog box so that the user can select a new image
    > > file, links the file, displays the image, and embeds the image in to the
    > > database.
    > >
    > > Private Sub Command1_Click()
    > > Me.ActiveXCtl3.ShowOpen
    > > 'Linked Image Code
    > > Me.Text2 = ActiveXCtl3.FileName
    > > Me.Image4.Picture = Me.Text2
    > > 'Embedded Image Code
    > > Me.OLEBound.OLETypeAllowed = acOLEEmbedded
    > > Me.OLEBound.SourceDoc = ActiveXCtl3.FileName
    > > Me.OLEBound.Action = acOLECreateEmbed
    > > Me.Refresh
    > > End Sub
    > >
    > > We can now create a report to display the embedded image is in a bound
    > > object frame and the linked images with the following code:
    > >
    > > Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)
    > > On Error Resume Next
    > > Me.Image9.Picture = Me.MyImage
    > > End Sub
    > >
    > > This example could be further modified to display only the desired file
    > > types in the Open File dialog. For additional information, please see the
    > > CommonDialog Control's Filter Property in the help file. If the
    > application
    > > is to be distributed to other machines I would favor using VBA code,
    > rather
    > > than the Commod Dialog Control to select the images. See article Q161286 -
    > > HOWTO: Use a Common Dialog File Open Dialog with Win32 API
    > >
    > > Image Quality:
    > > When we both Link and Embed the same file at the same time, we should not
    > > see any difference in the image quality.
    > >
    > > When we Embed the image in an OLE Object, we "wrap" the image with the OLE
    > > Server information so it will display even after we have removed the OLE
    > > Server (such as Photo Editor) from the computer.
    > >
    > > When we Link the image file we use whatever OLE Server is installed to
    > > display the image, or, if there is no OLE Server installed, then we use
    > the
    > > Graphics Filters that are installed with Office.
    > >
    > > For example, if we try to Link to a TIF file and there are no OLE Server
    > > applications installed that would display a TIF file, the TIF file won't
    > > display linked in Access because Office does not install the TIF graphics
    > > filter by default.
    > >
    > > If we did the same thing using a BMP file, it would display because we
    > > install the BMP, JPG and several other graphics filters by default.
    > >
    > > In Office Setup, Add/Remove Features, Converters and Filters, Graphic
    > > Filters, you can see and change which graphics filters are installed.
    > >
    > > To see which OLE Server is currently being used by the operating system
    > for
    > > a file type, double click on an image file with the same extension as the
    > > one you are linking to (EG: BMP, JPG), and see what application it opens
    > in.
    > >
    > > When we double-click a JPG file, it will often display in Internet
    > > Explorer(IE). IE is not an OLE Server so it is the default JPG graphics
    > > filter that is enabling the JPG file to be displayed as linked in Access.
    > > By the same token, we can't embed a JPG file even though it can be
    > > displayed in both Access as a linked file and in IE.
    > >
    > > To embed a and display a JPG file, we would still need an OLE Server. Even
    > > is an OLE Server that supported JPG files was subsequently installed, the
    > > "wrapper" in the Access OLE Object field would be incorrect until we
    > > removed the image from the database and reinstalled the image with a valid
    > > OLE Server available.
    > >
    > > For additional information please see article Q158941: How to Load OLE
    > > Objects from a Folder into a Table, available from the internet at:
    > >
    > > http://support.microsoft.com/support/kb/articles/q158/9/41.asp
    > >
    > > For Access 2000, see the following articles:
    > >
    > > Q198466 ACC2000: How to Load OLE Objects from a Folder into a Table at:
    > >
    > > http://support.microsoft.com/support/kb/articles/q198/4/66.asp
    > >
    > > Q114214: How to Programmatically Embed or Link an Object in a Form,
    > > available from the internet at:
    > >
    > > http://support.microsoft.com/support/kb/articles/q114/2/14.asp
    > >
    > > Q210100 - ACC2000: How to Display an Image from a Folder in a Form
    > >
    > > http://support.microsoft.com/support/kb/articles/q210/1/00.asp
    > >
    > > Because Word install most of the Office Graphics Filters, the following
    > > articles may also be of Interest:
    > >
    > > Q210396 - OFF2000: Descriptions, Limitations of Shipped Graphics Filters
    > >
    > > http://support.microsoft.com/support/kb/articles/q210/3/96.asp
    > >
    > > Q212271 - WD2000: Graphics Filters Installed in an "Install Now" Setup
    > >
    > > http://support.microsoft.com/support/kb/articles/q212/2/71.asp
    > >
    > > Q212265 - WD: Additional Converters/Filters Available in Converter Pack
    > >
    > > http://support.microsoft.com/support/kb/articles/q212/2/65.asp
    > >
    > > Q235928 - WD2000: Supported File and Graphics Formats
    > >
    > > http://support.microsoft.com/support/kb/articles/q235/9/28.asp
    > >
    > > I hope this helps! If you have additional questions on this topic, please
    > > reply to this posting.
    > >
    > > Regards, Frank Miller
    > > Microsoft Support
    > >
    > > This posting is provided "AS IS" with no warranties, and confers no
    > rights.
    > >
    > >
    > >
    > >
    >
    >


  • Next message: Barry Stephens (Microsoft): "RE: Access 2002 SP3 Runtime error!!"
    Loading