Using a button to launch a second, linked form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rab26
    New Member
    • Oct 2015
    • 3

    Using a button to launch a second, linked form

    Hi,

    It has been a while since I have used Access and even then it was basic use. I think I am thus a little in over my head! Some advice would therefore be much appreciated.

    The data input form for my database is essentially made up of 3 sections:
    1) item description
    2) where from
    3) where going to

    In order to prevent the main form from getting too cluttered, I want the relevant controls for section 2 (and again for section 3) in a separate - but linked - form that is opened (in a new window) at the click of a button.

    I have managed to get as far as using a button to open another form. BUT, the forms don't appear to be linked: when tested, the dummy data used in the second (sub) form didn't appear in the associated fields in the underlying table(s) and warnings that I hadn't entered "required" fields [which were already completed in the first (main) form] were displayed.

    [I should say, I do NOT want to view see the data on the sub-form unless I click the button...my understanding of the sub-form function built into Access is that it is not appropriate here????]

    I am also a little puzzled as to what to do once the sub-form has been completed: I need the data to save and to return to the main form...

    Clearly, I am missing something... if you could give me a hint (or two!!!) I would be grateful.

    Thanks
  • zmbd
    Recognized Expert Moderator Expert
    • Mar 2012
    • 5501

    #2
    Have you considered using a tabbed control?
    ) Using Tabbed Pages on a Form
    ) Accessing Tabs on a Tab Control
    ) Create a tabbed form - the very basics

    You can also add true subforms to the pages, many of us that do so, do so, via a "late binding" method; however, from your post, I don't believe that subforms are the way to go here... just a plan, simple, tab-control.
    :)
    Last edited by zmbd; Jan 6 '16, 10:40 PM.

    Comment

    • jforbes
      Recognized Expert Top Contributor
      • Aug 2014
      • 1107

      #3
      I whole heartedly agree that a Tab control is probably what you want. I use it often and it works well.

      The one thing that struck me odd was the comment:
      [I should say, I do NOT want to view see the data on the sub-form unless I click the button...my understanding of the sub-form function built into Access is that it is not appropriate here????
      Typically, a Tabbed control will give you additional Screen Space to add fields from the Table that Form is currently based on.

      A Subform gives you the ability to display information from a table that differs but is related to the Table that the Form is currently based on. An example of this is a Form to show order information. It would be based on the Orders table, but a Subform on that Form would show the Order lines from a different table that could be called OrderLines. Multiple Subforms like this fit on Tabs quite well.


      Typically, the case of showing data or entering data only when a button is clicked is more of a dialog situation, where either the Data or the Validation of the Main Form varies greatly from what is needed to be displayed or gathered from the user. One example is using a Dialog Form to enter a New Order Line in the Order/Order Lines scenario, as the information needed for a new Order Line may rely on some advanced look up features that wouldn't fit on the standard Form display. Another (poor) example would be a Totals Form for the Order/Order Lines that would only be available when a manager is using the database so that dollar values aren't shown to anyone but managers.

      When you need a dialog, use can do something like the following (there are lots of variations on this):
      Code:
      DoCmd.OpenForm "NewOrderLine", acNormal, , , acFormAdd, [iCODE]acDialog[/iCODE]
      Me.Refresh
      The first line opens the Form as a Dialog, the second line refreshes the Main form after the Dialog Form has been closed.

      The Tab Control is probably all you need, but hopefully this helps you understand your options a little better.
      Last edited by jforbes; Jan 7 '16, 06:09 PM. Reason: [z{fixed quote tag :) }] [jforbes{Thank you}]

      Comment

      Working...