开发者

Populating a subform with different displays as a GUI in Access 2007

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
    subf开发者_如何学运维orm.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 :)


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜