PDA

View Full Version : Solved: Need to show menu bar in Access DB



Jacob Hilderbrand
12-14-2004, 11:21 PM
Ok, so I have a little problem here that hopefully someone can help with.

At work we have an Access data base that is used to input certain data. Unfortunately this program is regional and not open source at all for me. :(

There is one menu bar at the top of the db that controls everything, but there is a problem. The menu bar is gone for some profiles (i.e. some people have it and some don't). I played around with it a bit and the menu bar can be de-docked and closed, but after that it cannot be shown again.

I can go to the VBE and see all the macros and forms, however, the project is unviewable if I try to open one of the modules. There is no project password, its just unviewable. I am using Access 2002 so maybe the db was created in 2003 or with another program, I dunno.

Anyways if this was Excel I would just write a script to enable the toolbar, but I am not sure how to do that with Access.

Remember I cannot add any code to the project since it is unviewable so the code for any solution would have to be run from another Access db or perhaps Excel/Word.

Let's use these names:
Program Name: db1
Project Name: project1
Toolbar Name: toolbar1

Thanks

Andy Pope
12-15-2004, 02:37 AM
Hi DRJ,

This code will run from an excel code module.
Adjust the path to suit.


Dim intIndex As Integer
Dim objDB As Object

Set objDB = GetObject("C:\db1.mdb")
For intIndex = 1 To objDB.CommandBars.Count
If Not objDB.CommandBars(intIndex).BuiltIn Then
If objDB.CommandBars(intIndex).Name = "toolbar1" Then
objDB.CommandBars(intIndex).Visible = True
End If
End If
Next


You might want to modify the code slightly so that first off it just prints all NON BuiltIn toolbars to the immediate window. That way you can see the actual names being used.

Jacob Hilderbrand
12-15-2004, 03:18 AM
That worked perfectly. :)

Thanks