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

File picker for image help

Status
Not open for further replies.

DBServices

Programmer
Aug 19, 2010
54
US
I am making a frmCustomers form. It is bound to the tblCustomers. On the form I want to put an image box (do i use image boxes, bound/unbound object frames, or Active X controls?). I want the image to only display the image, not store it in the database. I've used the File Dialog Picker before but I can't figure out how to do it again. In my tblCustomers I have a field called CustImagePath that I want to use to store the paths to the images for each customer. How do I use an image and then store and use the path to display the image? I have the MS Office Object library referenced. The way I did it before was I had an image on the form, a text box that was bound to the CustImagePath on the table. The image was connected to the text box somehow (maybe control source?). When I clicked the cmdAddImage button, the file dialog box would appear, only one item was allowed to be selected, and then the path to that image was put into the text box and then the image displayed the photos. I have searched help files and can't find exactly how to do this, so any and all help would be greatly appreciated...Thank you, Dannie.
 
Office library has a FileDialog object that you have to customise and show. Before displaying the dialog you can set DialogType, InitialFileName, Filters, AllowMultiSelect, InitialView and other properties. Show method returns user action (action or cancel button selected), FileDialogSelectedItems returns a collection of strings with full paths and file names of selected items.
All you need to do is:
1) read initial path, sonfigure FileDialog,
2) show file dialog, get user action,
3) if not cancelled, read user selection and fill textbox and image according to the selection.
All 1-3 require VBA.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top