Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Importing images problem. (Access 2003 SP2)

    I am trying to create a database at the moment which will import details of my home holiday videos. My import software creates a text file which includes all the standard date/time clip info, which I can handle OK. I

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Importing images problem. (Access 2003 SP2)

    You shouldn't store images in an Access 2003 (or earlier) database - even if you use small .jpgs, Access will store the uncompressed bitmap version of the images in the database in addition to the jpg version, so the file size will balloon quickly. The recommended approach is to store the path and filename of the image in a text field in the database, and to use a standard image control (not an unbound OLE control) and some VBA code to display the image. The database attached to <post#=296892>post 296892</post#> demonstrates how to do this in a form and in a report. The images can be .bmp, .jpg, .gif, .png, .wmf, .tif and several other graphics formats.

    You can use the following function (in a standard module) to split the field into individual file names:
    <code>
    Function SplitString( _
    WholeString As String, _
    Delimiter As String, _
    Segment As Integer)
    SplitString = Split(WholeString, Delimiter)(Segment)
    End Function
    </code>
    Create a query based on the imported table; you can use an expression like this to retrieve the first file name:
    <code>
    Pic1: SplitString([FieldName],";",1)
    </code>
    And similar for the others.

    Note: Access 2007 supposedly has much better handling of images, but I haven't tried it yet.

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Location
    Edinburgh, Midlothian, Scotland
    Posts
    492
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Importing images problem. (Access 2003 SP2)

    Thanks HansV,

    I've downloaded the databse you sugegsted and printed the code for the form and report so I can see how it works.I've also taken your advice about not showing the image directly, but linking from its original location.

    Finally the split string solution is a great idea. I had written a query to make new fields for each image, but this is much easier (and obviously more efficient).

    I can usually cope with taking snippets of code like your database and making it do what I want, but I have great difficulty in getting started without such help, so thanks again.

    These forums are a great resource. It is great when I can post stoopid noobie questions, and get such a prompt, polite, helpful and accurate reply. Keep up the good work on behalf of all us noobs.

    Thanks

    Colin

    .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •