Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2004
    Location
    OHIO
    Posts
    75

    Exclamation Unanswered: inserting an image into a report

    Hi!

    This is the deal...I am using access 2000 and have built a database to track volunteer working hours and contact information. In my volunteers table a I also store a photo of the volunteer.

    Ok--I've built a report to act as a directory of all my volunteers and I want each volunteer picture next to their contact info. In my photo field it just displays the image path, I can't get it to show the actual image.

    So, my question is how do i display their photo and when a volunteer is added to the database with a photo and i run a report their photo shows up in the directory?

    Help would be greatly appreciated!

    Thanks,

    Brad

  2. #2
    Join Date
    Dec 2003
    Posts
    172
    Hi Brad,

    This was a fun one to demonstrate.

    I mocked up a demo - download the attached file.

    Here's how it works...

    There are two tables, ImageTable and ProgramDefaults.

    The image table stores the photos. To make it simple, I just created a bunch of BMP images in MS Paint. Of course photos will work also. The image table can be adapted to whatever table holds your photos.

    The report is bound to the image table and has 3 controls on it. There is an image control called ImageFrame to display the image, and there are two textboxes (which you can set to visible=false for the real database to hide these) called txtImagePath and txtImageFile.

    The control, txtImagePath, is a calculating text box that gets a default path from the ProgramSettings table using DLookup(). You should open ProgramSettings and put the actual path to your images in there.

    The control, txtImageFile simply is a text box bound to the ImageTable and stores the actual image/photo filename.

    When the report runs, a piece of VB code in Report_Format grabs the field data behind txtImagePath and txtImageFile and assembles the path and file name. It then sets the ImageFrame picture property to the actual disk-based image (BMP in my sample).

    I also put a little extra thing in the code that uses DIR to check to see if the path and filename are valid for that image. If they aren't, I tell the ImageFrame to display a image called Missing.bmp which has the words, Picture Missing in a square box on a white background.

    Again you can modify all of this to suit your needs.

    To demo the attached project, copy the bitmap BMP images to your C:\ root folder and open the MDB file and preview the report. You will see 4 images, Image1 - Image4 displayed on the report in sequence from the ImageTable. I purposely left out Image5.bmp so that my error routine would display the Missing.bmp to demonstrate how that works.

    Have fun with this. Let me know if you have any questions. I'm leaving for a trip out West day after tomorrow but I'll be online here tonight and partly tomorrow.

    JoeG
    Attached Files Attached Files

  3. #3
    Join Date
    Jan 2004
    Location
    OHIO
    Posts
    75

    Taking a gander

    JoeG,

    Thanks for the demo, Joe! I appreciate your time. I will be working with this later today, and will get back to you with any successes or questions.

    Thanks again,

    Brad

  4. #4
    Join Date
    Jan 2004
    Location
    OHIO
    Posts
    75

    success!

    Its a success! I had to manipulate and customize some of the VB and field names, but your code took the pressure off! I've been wreastling this for a few hours before i posted my question and the solution was as simple as it gets.

    Thanks again, and have a good trip!

    Brad

  5. #5
    Join Date
    Dec 2003
    Posts
    172
    glad to help

    joeg

  6. #6
    Join Date
    Jan 2004
    Location
    OHIO
    Posts
    75

    JoeG - any good at SQL?

    I am having a problem with age and date ranges.
    I need to create a report that shows the total number of volunteers that are within the following age ranges:
    under 15
    15-19
    20-24
    25-34
    35-44
    45-54
    55-64
    65-74
    75-84
    85-94

    I currently have a table that has the min and max for the age ranges and the volunteer table has the birthdate - the age is calculated from the birthday when entered in the volunteer form. I am stuck on how to show the number of volunteers within each range when a date range is entered. It seems to work without the date range but once the date range is set as a criteria it doesn't work right.

    The output should look like this:

    Form (Report Date Range):
    Begin Date:12-1-2000
    End Date: 12-1-2003

    Report (rptAgeRanges):
    Age Range Total #
    under 15 5
    15-19 10
    20-24 15
    25-34 25
    35-44 25
    45-54 25
    55-64 20
    65-74 20
    75-84 10
    85-94 5
    Grand Total: 160

    Thanks in advance!

  7. #7
    Join Date
    Dec 2003
    Posts
    172
    Hi Ironchef,

    I'd be happy to look at your next question. Unfortunately I am leaving for a trip shortly and will be traveling all day. If you still haven't gotten an answer by the time I get into the West Coast tonight, I'll log on and see if I can help you.

    JoeG

Posting Permissions

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