Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 9th, 2004, 11:50 AM
Authorized User
 
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default Linked images in report records

I am trying to put linked images in the records displayed in a report using Access XP. There is section in Access Help that describes doing this in a form and in a report, but I can't get it to work in my report. Their suggestion says to add an Image control and set it's Picture property to any picture, add a Textbox to the report showing the path to the picture for the record and add this code to the report_current event:

On Error Resume Next
Me![ImageControlName].Picture = Me![ImagePath]

My report doesn't have an event named current and it doesn't work when I add the code to the Open event. I have changed the [ImageControlName] to reflect my Image control and [ImagePath] to the name of my textbox containing the record's path and filename of the picture.

I would appreciate any help you could give me on this.

Nashville_Bill
__________________
Nashville_Bill
 
Old February 9th, 2004, 12:02 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check out the following sample database for an example such as you describe and many others detailed below.

Microsoft Access 2000 Sample Reports
30 Sample Reports available for download which include dynamically sorting and filtering your data, creating complex totals, faxing reports, printing custom labels, customizing page layout, and many more.
http://support.microsoft.com/default...b;EN-US;231851

It has some great examples in it for the beginner, and even the ‘not so’ beginner. Below is a list of topics within the database:

Draw Vertical Lines in a Section that Can Grow
Setting Filter, FilterOn from a Popup Form
Setting OrderBy, OrderByOn from a Popup Form
Keeping a Subreport or Text Box Together
Setting the Filter Property to a Form's Filter Property
How to Reference Parameters in Reports
How to Create Fixed-Scale Charts in Reports/Forms
How to Print Blank Line Every Nth line in a Report
Using HasData When Referencing a Subreport Control
How to Repeat Group Header in a Report
Creating a Top Values Per Group Report
How to Print Odd or Even Pages of a Report
How to Print Line Number for Each Record/Group on Report
How to Use Automation to Print Reports
How to Fill Text Boxes on a Report Using Visual Basic
How to Sum a Column of Numbers in a Report by Page
How to Create a Table of Contents or Index for a Report
How to Print a Constant Number of Lines Per Group
How to Shade Every Other Detail Line on Reports
How to Specify a Custom Starting Page Number for a Report
Converting Numbers to Words for Check Writing
Eliminating White Space in Reports with CanShrink & Code
How to Make Empty or Null OLE Object Not Appear on Report
Send Fax through MSFax using Code Example
How to Skip Used Mailing Labels and Print Duplicates
How to Create a Top 10 Report
How to Use Visual Basic Code to Collate and Print Two Reports
Page Header That Spans Full Width of Multi-Column Report
How to Repeat a Subreport's Header When Subreport Spans Multiple Pages.
Send Fax through WinFax using Code Example

Regards,



Beth M
 
Old February 9th, 2004, 01:45 PM
Authorized User
 
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Beth,

Thanks again for the help. I have found the report with the Photo (bound object frame control) and see that it works, but I can't duplicate it on mine. I just get a blank frame. Do you know if there is some underlying code that makes it actually display the photo and will it work with JPG images as well?

Bill

Nashville_Bill
 
Old February 9th, 2004, 01:53 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You might check in the modules section of the database. It looks like the Detail On Format event they are calling =HideNullOLE([Photo]).

However, after opening this db, I would NOT suggest embedding images, but linking to them. And I would assume you could use a .jpg, .gif or .bmp. I have never created a report which displays the images, but I thought maybe this db had something in it to offer you.

Beth M
 
Old February 10th, 2004, 10:40 AM
Authorized User
 
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The module appears to me to only hide the control if there is a null in the table. By the way, the control (photo), which is hidden under a text box, is linked to the table (employees) and the field (photo) and they aren't listed in the database window. However there is an employees table with a photo field(text field) in the Northwind sample program. Confusing, Huh.

Nashville_Bill
 
Old February 10th, 2004, 10:59 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The photo field in the Employees table has an image embedded, and this is what I would advise against due to database bloating.
 
Old February 10th, 2004, 12:54 PM
Authorized User
 
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I guess that is why it didn't work for me when I tried to use my linked photos.

Nashville_Bill
 
Old February 10th, 2004, 02:46 PM
Authorized User
 
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

OK -- I found a solution. As always, it is simple if you go in the right direction.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strLogo As String
  strLogo = "C:\aNIS\Logo\NashvilleInventoryLogo4.jpg"
If IsNull(Me("txtImagepath")) Then
  Me![imgImage].Picture = strLogo
Else
  Me![imgImage].Picture = Me![txtImagepath]
End If

End Sub

The only thing I couldn't figure out was how to leave the image control blank if there was no file name in the field so I inserted my logo. Also, I get a "importing" window for each record when opening the form and then again when looking at each page of the report.

Nashville_Bill
 
Old February 10th, 2004, 02:57 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 174
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Good job!
 
Old February 10th, 2004, 03:13 PM
Authorized User
 
Join Date: Dec 2003
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks - I got rid of the Null problem.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

If IsNull(Me("txtImagepath")) Then
  Me![imgImage].Visible = False
Else
  Me![imgImage].Visible = True
  Me![imgImage].Picture = Me![txtImagepath]
End If

End Sub

Nashville_Bill





Similar Threads
Thread Thread Starter Forum Replies Last Post
Linked Images in Firefox Showing Underline kwilliams CSS Cascading Style Sheets 1 March 27th, 2008 03:01 PM
How load images on report from report path hyder_master Crystal Reports 0 October 5th, 2007 05:17 AM
deleting records in linked tables tico31pl Access 4 May 18th, 2006 04:10 PM
why images are not showing up in my report? yuqlin BOOK: Professional SQL Server Reporting Services ISBN: 0-7645-6878-7 6 November 29th, 2005 04:15 AM
Dynamically inserting images in the report ashu_from_india Crystal Reports 0 February 22nd, 2005 12:46 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.