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 January 31st, 2007, 05:53 PM
Authorized User
 
Join Date: Sep 2003
Posts: 83
Thanks: 0
Thanked 0 Times in 0 Posts
Default problem with inserting images in Access report

Hello everyone,

I have a really weird problem while insering images in an Access report.

I have a table where one of the rows contain path to an image on the disk. This may also be NULL, in which case I do not want to show an image.

In my report, I added an Image control and used the detail section event handler as follows:

The Me.Photo refers to the control source that gives me the path.
Me.Image32 is the name of the image control in the detail section.

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

    If Not IsNull(Me.Photo) Then
        If Len(Dir(Me.Photo)) > 0 Then
            Me.Image32.Picture = Me.Photo
        Else
            Me.Image32.Picture = ""
        End If
    Else
        Me.Image32.Picture = ""
    End If
End Sub

Now, something very stange happens. My table contains 6 ecords. The first 2 have NULL values for the photo and this handles that properly.

Then I have a valid image, this is also handled fine.

Then I have 2 invalid paths followed by another NULL value. What happens is that the valid image is shown on all of those rows!

So, it seems as soon as one valid image is hit, the picture property just gets set to that! It is really bizarre...

I do not know what I am doing wrong. If someone has any ideas, please help!

Cheers,
Pankaj

 
Old February 1st, 2007, 08:45 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Try this:

If IsNull(Me.Photo) Or Me.Photo = "" Then
   Me.Image32.Picture = ""
Else
   Me.Image32.Picture = Me.Photo
End If


mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in inserting a new row in MS Access yzlin04 VB.NET 2002/2003 Basics 2 July 18th, 2007 11:11 PM
Problem with inserting a new row in MS Access yzlin04 VB Databases Basics 0 July 15th, 2007 11:23 PM
having problem in inserting in access database alto ASP.NET 2.0 Basics 4 May 24th, 2007 08:57 PM
Inserting Images Into Report From My database mms18 Crystal Reports 2 July 6th, 2006 02:25 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.