Zharphyn
asked on
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
Thanks
Brad
ASKER
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
Thanks
Brad
Can you post the code you are using to display the images?
What type of control are you using to display the images?
What type of control are you using to display the images?
ASKER
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.
Thanks
Brad
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
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
Thanks
Brad
Try this on both systems (if you examine it you will see that it is very basic)...and report back...
;-)
Jeff
Access-BasicLinkFormReportImages.mdb
;-)
Jeff
Access-BasicLinkFormReportImages.mdb
ASKER
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
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
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)?
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)?
ASKER
ASKER
Hi Boaq,
I just did another check, and the run time error is thrown when it tries to load the image.
Thanks
Brad
I just did another check, and the run time error is thrown when it tries to load the image.
Thanks
Brad
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
ASKER
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
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
In any event, follow danishani's advice and add error handling to all your subs...
You might check for Sandbox mode as well:
http://www.fmsinc.com/free/newtips/access/accesstip19.asp
Hope this helps,
Daniel
http://www.fmsinc.com/free/newtips/access/accesstip19.asp
Hope this helps,
Daniel
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?