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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Attaching pictures to a form

Status
Not open for further replies.

gianina

Technical User
Jul 4, 2006
56
CA
Hello,

Is it possible to facilitate a user with the option of attaching a picture on a form ?

Thanks.
 
Add an Image control to your form, setting the Picture property to some image. Then, add some functionality to allow your user to select an image file, then programmatically set the Picture property of your image control to the image file the user selects.
 
Something like this...

Me.ImageControlName.Picture = InputBox("Enter an image file name")
 
Or you can check out the Microsoft Common Dialog Control that will allow your users to browse for an image file.
 
You kind of lost me...

How do I add an Image Control to my form ?
Where exactly do I enter the code you provided ?

When trying to insert the Microsoft Common Dialog Control, I get the following message:

"You don't have the licence required to use this ActiveX control"

Thanks.
 
In the Design View of your form, click on the "Image" button on your Toolbox. Place the control on your form...it will bring up a file selection box for you to specify an image file. Select an appopriate starting image. Name the control "myImage"

I was assuming that you wanted to allow your users to put an image on the form, in runtime...am I right? If so, you can just add a button to your form, and in the OnClick event of that button, add the following line of code...

Me.myImage.Picture = Inputbox("Enter the path to your image")
 
Regarding the error you're getting with the Common Dialog Control...what version of Access are you using?
 
I did some googling on the error. It appears that you need to have a developer product installed (VB or Office Developer Edition) in order to use the Microsoft Common Dialog Control.
 
I entered the code and nothing happens at the press of the button.
Also, if my assumption is right this way the user have type in the adrress of the picture. Is it possible provide a "browse" option ?

Thanks again for your help.
 
That's what the Microsoft Common Dialog Control would give you...the ability to browse for a file.
 
What did you name your Image control (right click...Properties...Name property)? On your button, can you right click and select Build Event, and post the code behind the button?
 
gianina...I wonder if you'd be open to the idea of sending me your db? Perhaps I could get it working for you. Of course, that depends on what version of Access you're using. If it's not Access XP or 2003, I won't be able to help.
 
Now a window pops-up and asking for the path of the image and when I enter it (path is my computer) an error message comes up:

"Run-time error "2220"

Microsoft Access can't open the file C:\..."

Do you know what might be the problem ?
 
Did you move or delete the image you had set for the Picture property?
 
1. What version of Access is this DB?
2. Would you be willing to send it to me so I can take a look at it...and perhaps fix it for you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top