By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,679 Members | 2,763 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,679 IT Pros & Developers. It's quick & easy.

MSACCESS 2003 : How to use command buttons to display different subforms

P: 1
MSACCESS 2003 : How to use command buttons to display different subforms

I have an application that display information about Pipelines and these pipelines have many other equipments attached to them like ‘Valves’, ‘Tanks’, ‘Pumps’, etc.

In this application I display using Access form, all details about a selected Pipeline. And I included in this form, a sub-form which display valves information by default.

What I would like to do is to create several buttons that once any one get clicked, will somehow replace the subform displayed and replace with another one subform. All subforms are have the same parent/child field link.

I tried to the change the SourceObject using OnClick events for the Buttons but no luck.
Sep 5 '07 #1
Share this Question
Share on Google+
1 Reply


P: 47
Seems to me the simplest solution is to stack the 3 forms one on top of the other, and make the required one visible when the button is clicked.

e.g

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button2_Click()
  2. subform1.visible=False
  3. subform2.visible=True
  4. subform3.visible=False
  5. End sub
The code for the other bittons will be identical except that a different subform will have visible=True.

Set the default condition (I'm assuming this is subform1 visible) in the FormOpen event:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. subform1.Visible = True
  3. subform2.Visible = False
  4. subform3.visible=False
  5. End Sub
Hope this helps
Sep 5 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.