Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Runtime Error 13

Status
Not open for further replies.

bobbobruns12

Technical User
Jun 30, 2004
27
US
Hey I am trying to create a cover sheet for a report in my database. I have placed an image frame on the report to call up the image path stored in one of my access tables. However I created a "default" picture that I want to put into my VB code to input it if no image path for a picture is available. My code looks like this and works if the file contains a picture, however whenever there is not a picture available it runs type mismatch. Am I missing something?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(Me![ImagePath]) Then

Me![CoverImageFrame].Picture = Me![ImagePath]
Else
Me![CoverImageFrame].Picture = "c:\Documents and Settings\Kevin F Bransfield\Desktop\pictures\nophoto.bmp"
End If
End Sub

Thanks for your help
Bob
 
I would have a look at LoadPicture().

Hope this helps

HarleyQuinn
---------------------------------
Help us to help you,
read FAQ222-2244 before posting.
 
Hey thanks I think I'm party way there. However now I'm getting a different error. I created this code

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Not IsNull(Me![ImagePath]) Then
Me![CoverImageFrame].Properties("Picture") = Me![ImagePath]
Else
[CoverImageFrame].Properties("Picture") = LoadPicture("C:\Documents and Settings\nophoto.bmp")
End If

End Sub

However it Highlights
Me![CoverImageFrame].Properties("Picture") = Me![ImagePath]

and says the value you entered isn't valid for this field.
 
Is Me![ImagePath] just a path and name of a picture file? Just like your default 'no picture' file?
 

Me![CoverImageFrame].Properties("Picture") = LoadPicture(Me![ImagePath])
 
Ok I put that in and it says that I created an expression with no value and highlights the code from above. I must have to add something to cancel the code if there is no path?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top