UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Displaying Images on Access Report - Error on empty imagepath    
 
   
heecack
post May 29 2009, 03:48 PM
Post #1

New Member
Posts: 8



I followed these instructions and it works perfectly: http://support.microsoft.com/kb/148463

However, there are some records that do not have images so the imagepath is empty. This causes an error right off: "Microsoft Office can't opent the file: XXX"

What code can I add to make it just skip if the imagepath is empty?

Any help is truly appreciated.

Thanks,
Sheila
Go to the top of the page
 
+
fkegley
post May 29 2009, 03:52 PM
Post #2

UtterAccess VIP
Posts: 23,583
From: Mississippi



I would change the code in both places to this:

Private Sub Form_Current()
On Error Resume Next
If IsNull(Me![ImagePath] Then
Else
Me![ImageFrame].Picture = Me![ImagePath]
End If


End Sub
Go to the top of the page
 
+
heecack
post May 29 2009, 04:40 PM
Post #3

New Member
Posts: 8



fkegley, Thanks so much for your reply!

I used your suggested code and the report ran but for the images that were missing it filled them in with the images from the record above. I need it to leave that space empty or show the default image to signify there was no entry for that record.

Any other suggestions?

Thanks,
Sheila
Go to the top of the page
 
+
Bob_L
post May 29 2009, 04:45 PM
Post #4

Utterly Banned
Posts: 7,038



1. create an image of a white square so it blends in (if that is your background color) and then name it blank.jpg or something like that.

2. Use Frank's code:
CODE
Private Sub Form_Current()
   On Error Resume Next
      If IsNull(Me![ImagePath] Then
         Me![ImageFrame].Picture = "C:\YourPathToTheBlank"
      Else
         Me![ImageFrame].Picture = Me![ImagePath]
      End If
End Sub


That is one way around it.

Also - Frank if you aren't going to have something after

If IsNull(Me![ImagePath] Then

Just change it to

If Not IsNull(Me![ImagePath] Then

So you don't have an Else where you don't need an Else.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 22nd May 2013 - 12:29 AM