Error 2147418113 -Method failed

T

Thronz

I have a Userform that is used to create a printed form. One of the command
buttons runs trhe following code:

Private Sub Photo_Click()
Dim locat As String
'Load Photo onto Userform
locat = "N:\Security\Reception\Contractors" & "\" & TextBox5.Value & ".jpg"
Image1.PictureSizeMode = fmPictureSizeModeZoom
Image1.Picture = LoadPicture(locat)
End Sub

This was running fine. I was then asked if the information entered on the
Userform could be used to update a database. This is done in another Sub
routine (same one as the code to print the form). I had it working, but I
find out now that an error is generated when the "Photo" commandbutton is
activated. The second to last line of code :"Loadpicture" causes the error.

Thanks for your time.
Happy Holidays
 
C

Cindy M.

Hi =?Utf-8?B?VGhyb256?=,

Hard to say without seeing all the code and know in which code module it
resides, but my guess would be that something may be going out of scope at
some point.

If you hardcode the path for locat, as a test, do you see any different
behavior?
I have a Userform that is used to create a printed form. One of the command
buttons runs trhe following code:

Private Sub Photo_Click()
Dim locat As String
'Load Photo onto Userform
locat = "N:\Security\Reception\Contractors" & "\" & TextBox5.Value & ".jpg"
Image1.PictureSizeMode = fmPictureSizeModeZoom
Image1.Picture = LoadPicture(locat)
End Sub

This was running fine. I was then asked if the information entered on the
Userform could be used to update a database. This is done in another Sub
routine (same one as the code to print the form). I had it working, but I
find out now that an error is generated when the "Photo" commandbutton is
activated. The second to last line of code :"Loadpicture" causes the error.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 
T

Thronz

It's been a while since I've been able to work on this.
I am still getting the error message.
I have tried this:

Private Sub Photo_Click()
Dim Image1 As Object
Image1.Picture =
LoadPicture("N:\Security\Reception\Contractors\nopix.Jpg")
End Sub

and I have even tried it with the graphic as a bitmap due to some info I
read about supported file types, but no luck.
The intent of the project is to load the photo onto the userform by clicking
a button, then the operator fills a few fields and clicks another button to
print the form.

Can anybody help?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top