Page 1 of 3 123 LastLast
Results 1 to 15 of 42
  1. #1
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Insert a Linked graphic file into table 'package' (Access 2003)

    On access 2003 when I do Insert Object, create from file link to say c:a.jpg. it shows on the table as a "package" vs in Access 2002 of Microsoft photoeditor 3.0 Photo See photo. Then on the report it shows an icon of a.jpg versus the actual graphic.
    What is happening?
    Jerome
    Attached Images Attached Images
    • File Type: jpg a.jpg (33.4 KB, 1 views)

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

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Embedding pictures in OLE fields in a table is not a good idea - it causes tremendous bloat. Access stores an uncompressed bitmap image alongside every jpg, so a single 640 by 480 pixel colour image will take up a megabyte or more. The preferred approach is to store the path / filename of pictures in the table, and to use code to display the pictures on a form or report. The database attached to <post#=296892>post 296892</post#> demonstrates how to do this.

  3. #3
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Hans:
    Unfortunately I have reports with querys based on embedded objects. Which for me would take a lot of time to rewrite. Your demo database was very nice and I would like to use it but I also need it to have 2 photos capability per line item and to convert 3 of my reports over. Know any volunteers????
    Also despite the bloat can i make insert linked graphic files in 2003 work the same way as before so that embedding links work the way it used to??
    Jerome

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

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    I don't have Access 2003 so I'm sorry...

  5. #5
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Is it easy to add a second photo to your sample database ie potential of 2 photos per record versus just one and have the report show 1 or 2 or 0 depending on how many there??
    Jerome

  6. #6
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Hans:
    I imported your form and report to my database and could not get it to work. So I exported by table cme and my 2 photo report to yours so you can see the error messages. I kept it in 2000 NOT 2003 format. And I had to zip it
    Any help I would appreciate
    Jerome
    Attached Files Attached Files

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

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    There is no table CME in the database you attached, so the associated report can't be opened.

    I modified the demo to be able to store an unlimited number of image paths per record in the main table. This is done by putting them in a separate table, linked to the main table by ItemID. There is a corresponding subform and a corresponding subreport.
    Attached Files Attached Files

  8. #8
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Hans
    Thanks I will study it in an hour. I have reattached the cme table in a new zip. As it was giving me an error could not find the l field??
    Jerome
    Attached Files Attached Files

  9. #9
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Hans:
    This is really great thanks,
    1. Any way when you go to add an additional photo that it is protected from replacing a current photo so you don't loose information. I may be in a rush and forget to go to add a new photo record before I insert the photo.
    2. Any way you can make it 2 photos side by side and down to conserve paper and trees??? ie
    1 2
    3 4
    56
    Thanks
    jerome

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

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    1. I have added a command button "Update picture" and some code to enable/disable the command buttons on the subform.
    2. This can be done by setting the subreport to two columns, and adapting the width of the subreport on the main report accordingly.
    See attached modified version.
    Attached Files Attached Files

  11. #11
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Hans:
    Many many thanks, this is wonderful. I have to look at it to understand the subreport but i never thought about such elegance in writing. You certainly make access whistle for you!!
    One note of interest if there are no photos on a record to start and start adding a photos, then the code to not allow you to overwrite does not kick in until you back step through the last photo or reload the form then the new code kicks in again my thanks this is just perfect.
    Out of curiousity what when the reports load it seems to read the photos once and then reads them again before showing the report on the screen ie 2 or 3 passes both for this version and previous versions. Doesn't this redrawing of the screen slow the report down??????
    Jerome

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

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Jerome,

    I left the Insert Picture button enabled after using it on purpose - if the user makes a mistake and inserts the wrong picture, he/she would have to move to another record and back to correct it. However,you could add code to the On Click event for the Insert Picture button to change the Enabled status of the command buttons:

    ...
    If OpenDialog(OFN) Then
    [PicFile] = OFN.lpstrFile
    [imgPicture].Picture = [PicFile]
    SysCmd acSysCmdSetStatus, "Afbeelding: '" & [PicFile] & "'."
    ' Must enable other button and set focus to it before disabling this button
    cmdErasePic.Enabled = True
    cmdUpdatePic.Enabled = True
    cmdErasePic.SetFocus
    cmdInsertPic.Enabled = False
    End If
    ...

    To avoid the pictures being read more than once, you can move the code from the On Format event to the On Print event of the detail section of the subreport, and add the following line at the beginning of the event procedure:

    If PrintCount > 1 Then Exit Sub

    See attached version
    Attached Files Attached Files

  13. #13
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Hans:
    Very very nice Thanks, How do I get at the sub report code I don't see it in design view. And How do I resize the photos, I don't see the field except for description in the design view mode. Do I have to look at the code directly??
    Jerome

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

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    To see the code module, select the subreport in the database window, and select View | Code or click the Code button on the toolbar.

    There is a text box txtCover on top of the image control imgPicture (it is notr really needed here, but would be useful if there were controls below the picture in the Detail section.) You can select txtCover and imgPicture together by clicking in the ruler to the left of them, then resize them together. You will have to take care that things still fit on the page.

  15. #15
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    NY, NY, USA
    Posts
    654
    Thanks
    10
    Thanked 0 Times in 0 Posts

    Re: Insert a Linked graphic file into table 'package' (Access 2003)

    Thanks for all, I will try them tonight
    Jerome

Page 1 of 3 123 LastLast

Posting Permissions

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