How to display a subform with a command button

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • emc_cos@msn.com

    #1

    How to display a subform with a command button

    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
    form/table.

    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.

    WOOHOO......


    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
    form.


    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.

    EMC

  • emc_cos@msn.com

    #2
    Re: How to display a subform with a command button

    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 .............Vi ew Macro

    Action......... ..........SetVa lue

    SetValue properties..... ........


    Item........
    [Name of Subform].Visible
    Expression..... ....
    Not [Name of Subform].Visible

    Anyhoo.....

    EMC

    Comment

    • John Welch

      #3
      Re: How to display a subform with a command button

      > The subforms are the data entry point for another table that holds[color=blue]
      > numeric values for time spent on tasks.[/color]

      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.[color=blue]
      >[/color]

      -John


      Comment

      Working...