UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Form With OLE Object On It, Access 2016    
 
   
RCDAWebmaster
post Jan 28 2020, 09:03 AM
Post#1



Posts: 77
Joined: 27-August 19



I have a form with an OLE Object on it. I can double click the field to open the object, which in this instance is a PDF. After looking at the PDF, I close it. Returning to the form, I'm unable to close the form because of an error: Microsoft Access can't save the changes to this bound OLE object. I realize that this is because I've locked the field so that users do not right click the object and change it without using the popup form.

A bit of research has shown me that I should set the OLE Bound Object Frame to Enabled NO, Locked YES then add in a button next to the OLE Bound Object Frame which has the following code (OLEObjectFrame is the name of the OLE object on the form):

Private Sub cmdOpenFile_Click()
Me.OLEObjectFrame.Action = acOLEActivate
End Sub

This allows a person to click the button to open the object and does not come up with that error. I like that it gets rid of the error, but folks are used to double clicking the object to open it as evidenced in other databases.

For now, I'm going to leave the field unlocked and hope that users do not circumvent the popup forms actions by right choosing Insert Object...

Is there any other way to eliminate this error that keeps the double click, like maybe some code that after opening the object, tells the form to disregard any changes?
Go to the top of the page
 
Doug Steele
post Jan 28 2020, 10:04 AM
Post#2


UtterAccess VIP
Posts: 22,244
Joined: 8-January 07
From: St. Catharines, ON (Canada)


Have you tried putting your code on the DblClick event?

CODE
Private Sub cmdOpenFile_DblClick(Cancel As Integer)
    
  Me.OLEObjectFrame.Action = acOLEActivate
  
End Sub

--------------------
Doug Steele, Microsoft Access MVP (2000-2018)
Personal webpage
Microsoft profile
Co-author: Access Solutions: Tips, Tricks, and Secrets from Microsoft Access MVPs, published by Wiley
Co-author: Effective SQL: 61 Specific Ways to Write Better SQL, published by Addison-Wesley Professional
Technical Editor: Access 2010 Bible, Access 2013 Bible, Access 2016 Bible, all published by Wiley
Technical Editor: SQL Queries for Mere Mortals: A Hands-On Guide to Data Manipulation in SQL, 4th Edition, published by Addison-Wesley Professional
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    16th February 2020 - 02:22 PM