I believe this has been asked before, but I can't get the search function to work. So will ask again...
I am using Access 2000, how can I get a command button to attach an image or photograph to a form?
A table has been established with a field called "photo" as an OLE object, what do I put down for the command button on the form to insert the picture? (the user should be asked to choose it from a directory/folder)
I tried to use some ways of storage of pictures in a database.
ole I think a way of use by the most unsuccessful
At my site have some examples
the most successful - use Activex keeping binary contents of a file in a field of the table
Unfortunately a site in Russian this is autotranslation of source annotation:
Storage of binary contents JPG, Gif a file in a binary field of a database.
In connection with that that the given way has demanded a lot of a program code - by me has been made special ActiveX control
approaches for: mappings of pictures in usual forms (not continiuos and not tabule) reports
of Feature of the given way: saving on compressed files - about 15 times!!!
As against other ways of storage of maps in a DB the data are stored in a database instead of on a disk
Soring it in binary is pretty much the only way to store image data in a database. That and storing all the vector coordinates. For both you would need some tool that would do this.
However the botch-job way would be to just store a 'link' to the immage and have a macro that runs that immage in an application of your choise.
I'm unsure as to what you need. If its just a matter of making a form look pretty all you need to do is create an image "box" (one of the tools in form creation wizard).
Hell you can even create 100 of them on top of eachother and set the controls to show/hide them depending on the records you select. Mind you it would be pretty hard to do maintenece on that form hehe.
Private Sub Btn_Path_Click()
Dim FName As String
Dim result As Integer
With Application.FileDialog(1) ' It is corrected : With Application.FileDialog(msoFileDialogOpen)
.Title = "Select picture"
.InitialFileName = "C:\" 'default path
.AllowMultiSelect = False
.Filters.Add "Picture files", "*.bmp; *.jpg", 1
result = .Show
If result = 0 Then Exit Sub
FName = Trim(.SelectedItems.Item(1))
on error resume next
me.imageObj.Picture = FName
I've attached the form/table for you to see what I have.
The path text box pulls the picture into the form wonderfully.
Where I am lost is placing a button (or something) in the form to have the user choose the file to place in the text box for the photo.
Let me tell you what I'm doing;
I work as a security officer in a large exclusive (kind of) privately owned hotel.
We often trespass people and take a digital picture which goes to E:\security of our computer.
I have a form built to tell a user about that person and have a text box and picture frame all working ok with each other to pull the picture off of e:\security.
In trying to make it as easy as possible for the non-computer literate people I'd like them to be able to use that command button to choose the file and have it automatically paste into the text box which will automatically update the form with the picture.
I've tried using Insert, Activex control, Common Dialog control, from the menu but get a windows error that the OLE server isn't registered and have had *NO* luck at all in troubleshooting any of this via the Microsoft web site.