Link to home
Start Free TrialLog in
Avatar of BAnders
BAndersFlag for Sweden

asked on

Commandbars behave differently with mde and mdb files with Access 2007

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.
Avatar of puppydogbuddy
puppydogbuddy

Avatar of BAnders

ASKER

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






















Do the following on the mdb, then regen the mde

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






Avatar of BAnders

ASKER

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!

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

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.
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
Avatar of BAnders

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of puppydogbuddy
puppydogbuddy

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BAnders

ASKER

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
Happy Easter to you as well!!

                PDB
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  
Avatar of BAnders

ASKER

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