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?
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.
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.
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:
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):
End Date: 12-1-2003
Age Range Total #
under 15 5
Grand Total: 160
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.