Editing linked images

G

Guest

I have an image(s) in an Image Box and I can't edit it by double-clicking.
I'm using the 'Image Frame', and not bound/unbound object frames. The image
is Linked and not embedded. Will Access only allow direct editing using
embedded images or is it possible to double-click a linked image and have MS
Paint or any other OLE app open the image for editing?

the error message I get:
A problem occured while Microsoft Access was communicating with the OLE
server or Active X Control

Cloe the OLE Server and restart it outside of Microsoft Office Access. Then
try the original operation again in Microsoft Office Access.
 
R

Rob Parker

It's possible to do this if the image type of the linked file has been
registered on your system (ie. the file extension is associated with an
image editing program); you need to code the double-click event of the image
control to call the appropriate code. As for the code to use, I suggest the
ShellExecute API via the code at http://www.mvps.org/access/api/api0018.htm

HTH,

Rob
 
G

Guest

Rob,

I gave it a try, but it throws these 3 lines up as 'red' error lines:

Public Const WIN_NORMAL = 1 'Open Normal
Public Const WIN_MAX = 3 'Open Maximized
Public Const WIN_MIN = 2 'Open Minimized

I don't know why, but thanks for the suggestion. I'll take the event out and
check if windows has unregistered the .bmp file extension.
 
R

Rob Parker

That sounds like you don't understand the information in the link I posted,
and you've simply put the published code into the double-click event of your
image control. Doing that will flag these lines as errors, since they are
public declarations which must appear before any functions/subroutines (ie.
at the top of the module). The code at
http://www.mvps.org/access/api/api0018.htm must be pasted into a standard
module (which cannot have the same name as any of the routines in it - in my
applications I generally put such routines into a module named
APIFunctions). The double-click event of the image control simply calls
this code; all it really needs is a declaration and a single line of code:

Dim strReturn as String
strReturn = fHandleFile(txtImageFile, WIN_NORMAL)

I add some additional code to deal with the possible error conditions
returned (in strReturn) by the fHandleFile function. This is the actual
code from one of my applications (it's actually from a textbox control
containing the image path/filename, and this routine is called from the
double-click event of the image control - there are two controls in my form
which a user can double-click to open the image file for editing) :

Private Sub txtImageFile_DblClick(Cancel As Integer)
On Error GoTo txtImageFile_DblClick_Error
Dim strReturn As String

If Not IsNull(txtImageFile) Then
strReturn = fHandleFile(txtImageFile, WIN_NORMAL)
Select Case Val(strReturn)
Case 0, 11, 31
MsgBox strReturn
Case 2
MsgBox "The file was not found." & vbNewLine & _
"It may have been moved or deleted." & vbNewLine & vbNewLine & _
"Use the 'Insert Image' button to re-link to the file if desired.",
vbInformation, "File not found"
Case 3
MsgBox "The path to this file was not found." & vbNewLine & _
"A network resource may be unavailable (perhaps temporarily)." &
vbNewLine & vbNewLine & _
"You may use the 'Insert Image' button to attempt to re-link to the
file.", vbInformation, "Path not found"
Case Else
End Select
End If

On Error GoTo 0
Exit Sub

txtImageFile_DblClick_Error:
If Err.Number = 490 Then MsgBox "The file was not found." & vbNewLine
& _
"It may have been moved or deleted." & vbNewLine & vbNewLine & _
"Use the Insert Image button to re-link to the file if desired.",
vbInformation, "File not found"
Resume Next
Else
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure
txtImageFile_DblClick of VBA Document Form_sbfrmArising_Remarks"
End If

End Sub

Again, HTH,

Rob
 
G

Guest

Hello Rob,

You are correct, I don't understand the information, though I greatly
appreciate your help with this problem. I have now managed to make it work
sucessfully by following your instructions. I can now double click on the
images and edit them.

Do you know how I can edit them within the form, without having to go
'outside' the Access window. I could do this in another database when the
pics were embedded into it; and when i wanted to edit, Access would just call
the MS Paint OLE menus, and I was able to edit 'In Form'

regards

Eric
 
R

Rob Parker

Sorry, I'm not aware of any method of doing that. It's probably possible -
in fact that's what several other apps do, including MS Graph, which is what
you get to (perhaps without even knowing it) when you double-click a chart
in a form to edit it. And it's likely to be what your other database was
doing. However, as I said, I can't tell you a method of doing so. And
there seems to me to be no really compelling need to do so.

If you really want to find out if it's possible, I suggest you post a new
message, with a more specific subject.

HTH,

Rob
 
G

Guest

Hello Rob,

Thanks for your feedback. The reason I want to do inline editing is because
the images are maps, and the map details are in a another form on the same
page, this way the user can see the details, and see the changes that he
needs to make on the map.

But, never mind, i am thinking of using Flash instead (not for editing), but
have a question; Do you know a way where I can link 2 Flash files to each
form based record in the same way that you have suggested for bitmap images.
I have tried using the method you prescribe, but it doesn't work. I'm
stumped, and would appreciate some advice.

regards


Eric
 
R

Rob Parker

Hi Eric,

Again, sorry. I've never worked with Flash files (well, apart from some
exploratory stuff years ago - and never interfacing with Access). If they
have a standard file extension, and a program registered to open that type
of file, the method I posted should work (but will open in a separate
application window). I also don't know whether you can display Flash files
in a control on an Access form - I would expect that you could. You might
find something at the Access Web site (http://www.mvps.org/access/) -
there's lots of good stuff there (and a search facility). If not, I suggest
you post a new question, with a specific subject line.

Rob
 
G

Guest

Hi Rob,

Yes, flash files will play just fine in an access form; but that's not my
problem. What I want to do is be able to reference the flash files via a
table field, just like i did in this example from Microsoft for storing
images. The beuty of it, is that i can link all the images within table
fields, rather than 'manually' placing them in a form record (I have over 600
images/flash files to process...)

http://support.microsoft.com/default.aspx?scid=kb;en-us;285820

Though, the trouble with this method is that because it uses an 'image
control' on the form instead of an AcitveX (the Shockwave Flash object) in
Access, there are no data control fields. So I was wondering if anyone had
tackled this problem before; there must be a way of controlling the data
connection for the control.

regards

Eric
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top