Archive for September 20th, 2008

Custom Menu

Saturday, September 20th, 2008

This is a kind of menu that allows us to save time, lines of code and a better arrangement in terms of open forms, since with this menu just need an open form. In addition to reducing the number of open forms also decreases the number of buttons in a menu to open each form.
This type of menu, certainly that has existed for some time and is already used by many users of Access.
So where is this menu?
Let's create the menu using a combo box that contains all the forms that we plan to open through it. When you select an option from the combo box the application form is displayed within the subform. Then we begin to make the menu step by step.

1 - Let's create a table where we will store the name you want to give each form and name of the form that will open. In the example I created the table 'tblmenu' with the following fields:
Field Type
Nomedomenu text -> Name that will be seen in the menu (combo box)
form text -> Name of the form that will open

After the data introduced in the example are:

NomedoMenu Form

Accounts Form1
Deposits Form2
Movements formulario3
Account-Box formulario4
Account-Account formulario5
Extract formulario6

2 - Then we create a query from the previous table:
Tblmenu chose the table and then choose the two fields in which we chose for ascending sort nomedomenu to be easier to find the menu quite a few times when we want to open forms. To this query I called 'CsMenu'.

3 - Let's create the form 'Menu', ie choose new form in Design view. Then we create a combo box and change the following properties:
- Number of columns: 2
- Column Widths: 1cm, 0cm;
- Origin of the line: csmenu (which is the name of the query created in the previous paragraph)

4 - In the same form we will create an unbound main form's subform (In the example I called menuquadro). It is this form that will be open each of the forms to choose from the menu (combo box).

5 - Now create a module that will allow us to open the menu that is selected in the combo box in the subform.
We created a module (which I called 'abrirmenu') and pasted the following code:

Public Function AtivarMenu (Combmenu The ComboBox, subabrir The Subform)
Abrirform As String Dim
= abrirform Combmenu.Column (1)
subabrir.SourceObject = abrirform
subabrir.LinkChildFields = ""
subabrir.LinkMasterFields = ""
End Function

After going to the properties of the combo box on the form menu and the After Update event put the created function: ativarmenu = ([Menu], [menuquadro]) that 'Menu' is the name of the combo box and 'menuquadro' the name of the subform.

And finally the menu is ready for use. Just try and use. I hope you enjoyed this tip.
Download: Menu

Below a picture of the menu.

Custom Menu

Custom Menu

Presentation

Avatar

Thank you for visiting.
Subscribe to feed not to miss any messages.

Here in blog I will provide examples of working with Microsoft Access and also ask questions to those who ask. More

Want to subscribe?

Subscribe or subscribe by email:
Enter your email:


Ads