Command button to change image in a form

tmarsh

tmarsh
Local time
Today, 13:32
Joined
Sep 7, 2004
Messages
89
I have a form with an image control that changes for each record from a table, images linked not stored. I can't get the code to work in a command button to open the Office File Open dialog. I want to be able to change the picture from the form.

Using
Private Sub AddPicture_Click()
' Use the Office File Open dialog to get a file name to use
' as an employee picture.
getFileName
End Sub
in the on-click of the command button I get a getFileName compile error.
 
Are you using the Common dialog control and the FileOpen switch?

David
 
Are you using the Common dialog control and the FileOpen switch?

David
I don't know! I copied code to the on-click event in the button. Do I need a module?
 
You need to insert an ActiveX control to your form called Common dialog control version n.nn Then code will work if written correctly.

Other than that you can use the File Scripting Object which will need adding to your references.

David
 
You need to insert an ActiveX control to your form called Common dialog control version n.nn Then code will work if written correctly.

Other than that you can use the File Scripting Object which will need adding to your references.

David
Thanks. I was using the standard command button. I'll give it a try. When I tried to add the control it says the OLE server isn't registered and as my PC is restricted on a network I'll have to wait for IT here to do it. Seems to be something to do with a dll not registered.
 

Users who are viewing this thread

Back
Top Bottom