changing image control's picture path

G

Guest

Greetings all,
i am trying to set up a data base that has informaton
about inventory items. on the form i have an image control
which hopefully will display a picture of the item. the
pictures file path will be in the database but i can't
seem to get the test code to work. i keep getting a error
on the line:
Image1.picture = picpath
error: compiler error object required.
code so far:
Private Sub CommandButton1_Click()
Dim picpath As String
Dim rng As Range
Dim Image1 As Control
Dim Picture As Property
Set myrng = Range("A1")
Set picpath = "H:\" & myrng.Value
Application.EnableEvents = False

Image1.Picture = picpath

End Sub
thanks in advance to anyone who can show me what i am
doing wrong.
 
T

Tom Ogilvy

Rather than
Image1.Picture = picpath

use
Image1.Picture = LoadPicture(picpath)

also, if Image1 is the name of the control, remove this line:

Dim Image1 As Control

Remove this line
Dim Picture As Property
 
G

Guest

thank you MISTER Tom Ogilvy
-----Original Message-----
Rather than
Image1.Picture = picpath

use
Image1.Picture = LoadPicture(picpath)

also, if Image1 is the name of the control, remove this line:

Dim Image1 As Control

Remove this line
Dim Picture As Property

--
Regards,
Tom Ogilvy




.
 

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