• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 427
  • Last Modified:

Blank Image in Access Form when using Runtime

I have an Access 2003 program that displays employee images when an employee record is opened.  The program has been working correctly previously, but I am now getting a strange problem in my test environment.  When I install the program on a clean machine, instead of getting my images displaying, I get blank fields.  This is happening in both Win XP and Win 7.  When I test the code on other machines it appears to work correctly.  The only significant difference that I can discern, is that my clean test machine does not have Office installed, and is using the Access 2003 runtime.  This has not been an issue in the past however.  I have tried both my mdb and my mde on several machines, and the test machine is the only one with a problem.

Thanks
Brad
0
Zharphyn
Asked:
Zharphyn
  • 7
  • 5
  • 3
1 Solution
 
danishaniCommented:
Hi Brad,

Where are the images stored? If Networklocation, are you currently connected to the network drive where the images are stored?
If images are stored on a BE. Is this a split FE and BE, and is the FE linked to the BE?
 
0
 
ZharphynAuthor Commented:
Sorry, I meant to mention that.  In the case of the test machine, the images are stored on the local drive in the sub-folder of the program file.  Files are present, named correctly, and can be opened by windows picture viewer.  The program determines the path to the images based upon the path to the program file.

Thanks
Brad
0
 
Jeffrey CoachmanCommented:
Can you post the code you are using to display the images?
What type of control are you using to display the images?
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 
ZharphynAuthor Commented:
Hi Boaq
I am just using the basic image control for Access.  I use images in different locations throughout the program.  I am attaching samples of two areas that display the image.  Neither of the procedures were written by me, instead, I just inherit someone else's code.  However, this code has been working for years, and I did not make any changes.

Public Sub LoadLogo(imgObject As Image)
    On Error Resume Next
    Dim sampleCompLogoFileExists As Boolean
    Dim compJpgLogoFileExists As Boolean, compBmpLogoFileExists As Boolean
    Dim imagePath As String

    imagePath = getDBLinkPath("tblSetup")
    imagePath = Split(imagePath, "SafeData.mdb")(0) & "images\"

    sampleCompLogoFileExists = PicFileInDefaultDirectoryFound(imagePath & "samplecompany.jpg")
    compJpgLogoFileExists = PicFileInDefaultDirectoryFound(imagePath & "companylogo.jpg")
    compBmpLogoFileExists = PicFileInDefaultDirectoryFound(imagePath & "companylogo.bmp")


    If compJpgLogoFileExists Then
        imgObject.Picture = imagePath & "companylogo.jpg"
    ElseIf compJpgLogoFileExists Then
        imgObject.Picture = imagePath & "companylogo.bmp"
    ElseIf sampleCompLogoFileExists Then
        imgObject.Picture = imagePath & "samplecompany.jpg"
    Else
        imgObject.Picture = ""
    End If

End Sub

Open in new window



Private Function loadPicture()
    On Error Resume Next
    Dim sampleEmpPicFileExists As Boolean
    Dim empJpgPicFileExists As Boolean, empBmpPicFileExists As Boolean
    Dim imagePath As String

    Me!imgPhoto.Visible = True
    Me!olePhoto.Visible = False

    imagePath = getDBLinkPath("tblSetup")
    imagePath = Split(imagePath, "SafeData.mdb")(0) & "images\"

    sampleEmpPicFileExists = PicFileInDefaultDirectoryFound(imagePath & "sampleperson.jpg")
    empJpgPicFileExists = PicFileInDefaultDirectoryFound(imagePath & Me!txtEmployeeNumber & ".jpg")
    empBmpPicFileExists = PicFileInDefaultDirectoryFound(imagePath & Me!txtEmployeeNumber & ".bmp")

    If Not IsNull(Me!txtEmployeeNumber) Then
        If empJpgPicFileExists Then
            imgPhoto.Picture = imagePath & Me!txtEmployeeNumber & ".jpg"
        ElseIf empBmpPicFileExists Then
            imgPhoto.Picture = imagePath & Me!txtEmployeeNumber & ".bmp"
        ElseIf Not IsNull(Me!Photo) Then
            Me!imgPhoto.Visible = False
            Me!olePhoto.Visible = True
        ElseIf sampleEmpPicFileExists Then
            imgPhoto.Picture = imagePath & "sampleperson.jpg"
        Else
            imgPhoto.Picture = ""
        End If
    Else
        If Not IsNull(Me!Photo) Then
            Me!imgPhoto.Visible = False
            Me!olePhoto.Visible = True
        ElseIf sampleEmpPicFileExists Then
            imgPhoto.Picture = imagePath & "sampleperson.jpg"
        Else
            imgPhoto.Picture = ""
        End If
    End If

End Function

Open in new window


Thanks
Brad
0
 
Jeffrey CoachmanCommented:
Try this on both systems (if you examine it you will see that it is very basic)...and report back...

;-)

Jeff
Access-BasicLinkFormReportImages.mdb
0
 
ZharphynAuthor Commented:
Hi Boaq
On both systems, it is throwing security errors, and crashing the program.  I will continue to try to get the program to run.  Do you have any suggestions?

Thanks
Brad
0
 
Jeffrey CoachmanCommented:
Not sure, this is my standard sample, I have posted it dozens of times with no reported errors.
That is why I posted it here... so you could test it

Can you try it on a personal computer (one connected to a company network)?
0
 
ZharphynAuthor Commented:
It works on my office machine, but not on my test box.  My test box has no applications installed, just an OS.  The test box is connected to the company network.

 Screen shot of error
0
 
ZharphynAuthor Commented:
Hi Boaq,
I just did another check, and the run time error is thrown when it tries to load the image.

Thanks
Brad
0
 
ZharphynAuthor Commented:
I just found an article saying that the 2003 runtime does not support jpg files.

Access & jpg

I tried the 2007 runtime on my test machine, and both my program and Boaq's work.  If this is the answer, why did it used to work?

Thanks Brad
0
 
danishaniCommented:
Hi Brad,

Do you have Error handling in place?
This is one of the requirements when using Access Runtime, else application will crash like you have.

Hope this gives more clarification on the error your receive.

Hope this helps,
Daniel
0
 
Jeffrey CoachmanCommented:
Investigate what danishani posted.

My sample will work in a standard Access install.

So if the Rutime is the only variable, then you have to investigate that.

There are also issues with running the runtime on the same machine that has the full version of access installed.
0
 
ZharphynAuthor Commented:
The error message and crash was actually from boaq's test program.  I did not check for error handling.

When I use the 2007 runtime rather than the 2003 runtime, my images load.  I think that I will use that as a workaround for those clients that do not have Office installed on their machine.

Thanks
Brad
0
 
Jeffrey CoachmanCommented:
In any event, follow danishani's advice and add error handling to all your subs...
0
 
danishaniCommented:
You might check for Sandbox mode as well:
http://www.fmsinc.com/free/newtips/access/accesstip19.asp

Hope this helps,
Daniel
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 7
  • 5
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now