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

How to display a subform with a command button

P: n/a
I have a very nice parent child relationship happening between a main
form and 8 subforms.

The main form is the data entry point for a table that holds textual
data like names, notes and the like. It also holds the primary key
which is an alpha-numeric file designation.

The subforms are the data entry point for another table that holds
numeric values for time spent on tasks.

These 2 tables have a relationship that is based on the alpha-numeric
file name.
When I have the subforms 'displayed' on the main form, I can enter
values for time into the subforms and the values are entered into the
table along with the alpha-numeric (primary key) from the main

The whole thing works perfectly through all records in the main form,
and when opening the main table the entries are displayed as they
should be as a relational dataset.

What would be optimal, is to be able to set the visible properties of
these subforms to a 'no' value and then have them capable of being
displayed with the on-click event of a command button.

The simple 'open form ' event procedure in the command button and
setting the visible to no in the subform does not do the trick. This
opens the form that has been created, but it is no longer recognized as
a subform and thus does not create the relationship between the 2
tables . In other words I can enter values but no file# is entered, it
does not recognize the current record set that is displayed on the main
How would one maintain the relationship of the current record displayed
on the main form to the unopened or undisplayed subform?
Or how would one go about displaying the subform with the on click
event of a command button?

I appreciate the tab concept but I want the security of the completely
undisplayed subforms that are only activated if .............

Any help is greatly appreciated .

Thanks in advance.


May 7 '06 #1
Share this Question
Share on Google+
2 Replies

P: n/a
Nevermind. I have found the solution with a simple macro build and then
applying that to the on click event of the command button.
If anyone has any interest this is the macro...

Macro Name .............View Macro


SetValue properties.............
[Name of Subform].Visible
Not [Name of Subform].Visible



May 7 '06 #2

P: n/a
> The subforms are the data entry point for another table that holds
numeric values for time spent on tasks.
You didn't go into much detail on your subforms, but it sounds like maybe
they all have the same fields, but just for different "jobs". Not sure, but
if this is the case, you might think about just changing which records are
shown in the subform (have it show the records WHERE job num = something)
instead of having a different subform for each job.

May 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.