Before providing my answers, I'm going to take a quick gander at rephrasing your question and it's requirements.
It sounds to me like you want to be able to load binary file objects, in this case pictures, using VBA, an OLE Object field in your table, and a Bound Object Frame.
for the sake of simplicty - let's say the user has to enter the file name themselves to a text box.
You could use Windows' temp directory or you can simply write out to the same file name every time you need to display an image. There's a really good article here to help you further understand what I'm talking about: a function to read in binary data (in this case your picture file) and another function to write out binary data: works well for writing your picture out to a "temp" file.
Then all you have to do is set the Picture property on your image control to be the file path and name of your temp file. Open "SELECT TOP 1 * FROM tbl Articles", cn End With 'Open our Binary Stream object and load our file into it Set mstream = New ADODB.
Here's some code to add pictures to the database using ADO: Private Function Load Pic Into Database(s File Path And Name As String) As Boolean On Error Go To Err Handler 'Test to see if the file exists. If Dir(s File Path And Name) = "" Then Exit Function Load Pic Into Database = True 'Create a connection object Dim cn As ADODB. Connection 'Create our other variables Dim rs As ADODB.
Microsoft is conducting an online survey to understand your opinion of the Msdn Web site.
but I initially put it this why, because I move around the database a lot, I don't care about efficiency since it is only a school project. Is the picture always at an expected location with an expected file name?
it's to late to change design anyway, due day is in a week. What exactly do you want to do if you don't use the Browse button?I get the correct id into a controll via a query and a combo box - so the controller is bound to: so that the bound OLE may update it's value. EDIT 2: So how is the filename acquired or derived? Is the picture always at an expected location with an expected file name?Anyway, I thought to do this just by VBA and a user entering a file adress,without using the controller but some kind of INSERT or somthing, but other options would be welcome. What exactly do you want to do if you don't use the Browse button?When you need to display the image you'll need to write it out to a temp file and then you can set the Picture property on an Image Control to the full path and filename for the temporary image file. Recordset, s SQL As String, s Temp Picture As String s SQL = "SELECT * FROM tbl Articles WHERE Article ID = " & Article ID Set rs = Current Db. It will be up to you to manage the image file as a temp file. Load From File s File Path And Name 'add a new record and read our binary file into the OLE Field rs. :( This is unfortunte since the porblem is fairly stright-forward.