Closed Gener4tor closed 5 years ago
What Version are You on? Because this issue has been previously raised and fixed at #4605
This is my version:
Version 2.3.0.4221 OS: Microsoft Windows NT 10.0.16299.0, x64 Host Product: Microsoft Office 2016 x86 Host Version: 16.0.4711.1000 Host Executable: MSACCESS.EXE
This is the same version as reported in the linked issue. Please update rubberduck to the current latest green release (v2.3.1.4308) and check whether the issue persists.
Hmmm...now I installed:
Version 2.3.1.4308 OS: Microsoft Windows NT 10.0.16299.0, x64 Host Product: Microsoft Office 2016 x86 Host Version: 16.0.4711.1000 Host Executable: MSACCESS.EXE
Now the "Open Designer" button in the CodeExplorer is grayed out and the function does not appear in the context menu anymore...
...so its still not possible for me to open the design view of my form.
As I found out now this happens only with Access-Forms.
With Userforms it seems to work. Sadly we dont use UserForms...
Access Forms are a special beast... They are possibly not recognized as components with a Designer.
From VBE's perspective, an Access form or report does not have a designer because you do not design it in VBE, but in the Access host.
We can get close using VBE's View Object
command. However, if the Access form/report is already open, regardless whether it is open in design view or. In normal/datasheet/layout view, the command will merely set focus to the object. Thus it is not a 100% equivalent substitute.
Nonetheless, we can determine if the module is a document module in which case we can expose the View Object
command instead of the Open Designer
command. That should work for all hosts.
A more complete solution could be in this form:
1) Add a bool CanOpenDocuments()
and bool OpenDocument(QualifiedModuleName module)
methods to the IHostApplication
interface
2) Implement virtual methods in HostApplicationBase
abstract class, defaulting CanOpenDocuments
to always false
with OpenDocument
being a no-op.
3) Implement the Access-specific methods for opening document in design view in AccessApp
class, taking care to dispose the DoCmd
object and containing appropriate checks.
4) Update the code explorer so that if it gets CanOpenDocument
= false
, to disable the Open Designer
menu item when it's a document module. Otherwise, it will enable the menu and defer the implementation to the host application. The code explorer also should have View Object
listed separately in the context menu at all the time (since it serves a slightly different function).
When I select a Form in the CodeExplorer and click on "Open Designer" nothing happens.
The same Nothing happens when I choose "Open Designer" in the Context menu...
In the VBE-build-in-Explorer the function "Show Object" works...