Solved

Commandbars behave differently with mde and mdb files with Access 2007

Posted on 2009-04-03
13
731 Views
Last Modified: 2013-11-29
Hi,

An application is developed with Access 2003 and a customized menubar (CommandBar) is used. VBA is used to customize the commandbars at the startup and also then different functions are used. It seems that no changed items are shown (I cant do drop down the sub-controls) for the combination of Vista, Access 2007 and .mde (compiled version in Access 2003). Notice that the properties Allow changes of Toolbar/Menubars is set to true and Full menus is set to false (I have tried true as well).

Is it Vista that needs to be configured? or Access 2007?

Nevertheless, why is it working with Vista, Access 2007 and the .mdb file? The rest is the same.

Thanks in advance

B Anders

PS It is very odd, the second time and the following the application is ran, one of the previous menu dropdown that didnt work is working.
0
Comment
Question by:BACapta
  • 8
  • 5
13 Comments
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24060768
0
 

Author Comment

by:BACapta
ID: 24060951
Thanks for the comment!

I have earlier seen that article. Still, the problem is that if I run the application by Access 2007:

The Mdb file - all the items in the menu is correctly set - it is not a built-in menu.

The mde file (same file as mdb but compiled) - first run: all set (changed) items are not available (not just only disabled, they are not visible = drop down(msocontrolpopup) doesn't work at all ), second run: one of the previous not working root menu is working correctly.

Regards
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24061262






















Do the following on the mdb, then regen the mde

try doing a compact & repair,then a decompile/recompile.  debug any errors on recompile.






0
 

Author Comment

by:BACapta
ID: 24066817
Sorry, still problems. I have done the following:
(a) compact and repair - what I know, there is no Access decompile feature. Still the problem.
(b) Since the Access previously has crashed and has had odd behaivor (both compiled and not compiled) after some time of development, it is cured by re-building the file. A new empty db is created, the old versions tables etc incl the menus are imported, the refrences for VBA are set. Normally the file shrink to half its size.
(c) add menu analysis dump software and I can notice the following:
     1. Allow full menu is false
         Allow Toolbar/menu changes true
         Allow built-in menus false
     2. The setting of the menus are correct - it is dumped as last line in the form_load event.
     3. I have a button on the form so that I can dump the menu items and the properties: It is not correctly set - so something happened between 2 and 3 and to my best knowledge, there is no code executed written by me.

Since, both Access 2007 and Vista have more secureity restrications - could it be something that needs to be configured? Macros are enabled. Notice if I turn on Full menus and allow builtin menus it works fine even for .mde.

What to do?

Thanks in advance for any ideas!

0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24067035
Try and follow this developers reference guide and see if there is anything you missed, Have you got the ribbon turned on or off?
http://msdn.microsoft.com/en-us/library/bb258174.aspx

0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24070104
I don't if this will work or not, but I think it is worth a try.  I am told this will protect the custom command bar against changes when the mdb iis compiled in Access 2007 and the mde is regenerated.  

add the following code to your mdb, then compile and regen the mde and see if it worked.

Commandbars("NameOfCustomToolbar").Protection=msoBarNoChangeVisible+msoBarNoChangeDock

the logical place to put the code is on the before the custom menubar/toolbar is loaded.

Let me know if it works.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24070115
PS:  see this link if you have not seen it before.  It is an interactive tool that enables you to map
Access 2003 commands to the equivalent in Access 2007.  It may not help you resolve your current problem, but it will help you in the future......I am mentioning it for the record because so many developers are not aware of this.

                  http://office.microsoft.com/en-us/access/HA102388991033.aspx
0
 

Author Comment

by:BACapta
ID: 24085810
Sorry - the problem has become even more peculiar. I have done the following:

(a) I have checked that I follow the reference guide. And I do!
(b) The .protection property has been set to the suggested values. The only thing that happens is that  
      after the Form_load event has ended is that a new error message is issued: NameoftheDatabase 
      cant find object RFX., RFX is the name of the commandbar  notice it is a dot added to the name.
      The menu bar is not visible at all after this message. The .protection is now set zero.
(c) I have write code to the menu and its properties and every thing are OK just before ending the
      Form_load event. No events follow. When I close the form, nothing is dumped since it cant find the
      commandbar RFX.
(d) The properties for Allow Full menus and Menubar changes have been tested for all combinations.
(e) The database application has been totally rebuilt by importing everything to an empty database in
      2003 format including re-settning the references. A sub-set just containing the start-up of the
      application has also been created - still same problem.

Still this is only a problem with .mde files but the .mdb works fine. What worries me is that the new behaviour introduced after the .protection property setting to the suggested values and it is still around after that the property is put back to zero.

Actually, what more can I do? Is it any information (dumps etc) I can attach so it is easier to advice?

By the way, the interactive tool for the 2003 2007 commands is great  I have just it a lot.
0
 
LVL 38

Accepted Solution

by:
puppydogbuddy earned 500 total points
ID: 24086151
BACapta,
Guess what? Your problem is listed as a bug by Allen Browne on his web pages devoted the conversion to Access 2007:
Custom Toolbar buttons may not work Some toolbar buttons do not work in MDE, e.g. if you copied the Close button from the Print Preview toolbar.
             http://allenbrowne.com/Access2007.html#Bugs
You may want to check if there is a hot fix  for this, or else try to write code to create your command bars from  scratch in Access 2007.   At least you know your mdb source file is not corrupted.
0
 

Author Comment

by:BACapta
ID: 24088949
puppydogbuddy,

Many thanks for the interesting link. I have a business partner that are using the combination Access 2007 and XP on a Apple computer. Then he is back from easter holidays, I will ask him to test the problem on his machine. I might even have a PC with XP and Access 2007 for a test.

One idea I have got is to use the docmd.showtoolbar command.

You have been of great help and when I have got answers to the above tests I will keep this issue open for to inform you about the result.

As we say here in Sweden: Happy Easter! /BA
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24090579
Happy Easter to you as well!!

                PDB
0
 
LVL 38

Expert Comment

by:puppydogbuddy
ID: 24091994
BACapta,
in case you were not aware MS offers free download of virtual pc to run 2003 and 2007 simultaneously on same pc.
 http://stackoverflow.com/questions/156694/is-it-safe-to-run-access-2003-and-2007-at-the-same-time  
0
 

Author Comment

by:BACapta
ID: 24179447
Hi,

It looks like the problem with not working commandbars with .mde and 2007 occurs when items are changed in the customized menu bar and the commandbar Menu bar is disabled. I have added to the commanbar code a feature for 2007 that re-creates the customized menu bar and it works fine. It is placed below the add-ins entry in the standard top ribbon (I have no idea if it is called that  anyway, it contains a home entry as well).

Since this looks very different from the documentation, I will issue a new question about to remove the Quick Access Toolbar etc.

Many thanks for the help. The step between 2003 and 2007 seems to be the largest step in Access history, isnt it?

BACapta
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now