views:

294

answers:

1

This is my first time building a UI in Access (using Access 2007), and I'm wondering what is the Right Way (TM) of going about this.

Essentially, I have several different queries that I'd like to display as pivot charts, pivot tables, tables, and reports. Eventually I'm also going to have to build forms to manipulate the data as well, but the application's primary function is to display data.

I'm thinking of having a button for each different display down the left side of the main window, and having the rest of the window display each button's corresponding contents (e.g. a pivot chart).

I have an idea that this can be accomplished using a single subform in the main form, and setting the subform's Source Object property within a function such as this one:

Public Function SetSubformSourceObject(newSourceObject) As Variant
    subform.SourceObject = newSourceObject
End Function

Then, for each button I'd set its OnClick property to call this function with the name of the query I'd like to run.

Now, I have no idea if this is the best way of going about things, and would really appreciate some input :)

A: 

The principle seems fair to me. You have to give it a try. You do not even need a form-subform structure. You can set your sourceObject at the form level, and have your buttons in a commandBar instead of having them as controls on the form, so you do not have any 'form specific' code (like "onCLick") and controls. action/command controls on a form are space, code and maintenance consuming, while commandbars are more generic and are THE object that can hold all your action controls.

Philippe Grondier
The commandBar seems like it would be a good alternative, but Google's telling me that MS took that feature out in Access 2007 in favor of the ribbon - see http://bytes.com/topic/access/answers/496898-access-2007-custom-menu-bars.Do you know if it's still possible to create something similar? That thread I linked to above suggests that it's possible to create a ribbon using XML, but I wasn't able to find much about this.
Richard
When I said commanBar I was also thinking about its ribbon alternative. The commandBar object comes from Office and is still available in Access 2007. Please check it here: http://stackoverflow.com/questions/1533297/how-do-i-use-an-access-2003-mde-with-access-2007-and-keep-my-custom-menus-toolbar
Philippe Grondier