Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2001
    Posts
    175

    Unanswered: Help with forms/sub-forms

    I have a main form and sub-form which are both shown in one window. Is there any EASY way to have the main form in one window with a button that calls the sub-form which opens in a another window without redoing the forms?

  2. #2
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173

    Re: Help with forms/sub-forms

    Did you want to keep the subform within the main form and open another copy of the subform?

    Else, simply remove the subform from the main form and add the button using the wizard to open the subform.

    I hope I understood your query correctly.


    Originally posted by toukey1
    I have a main form and sub-form which are both shown in one window. Is there any EASY way to have the main form in one window with a button that calls the sub-form which opens in a another window without redoing the forms?

  3. #3
    Join Date
    Sep 2001
    Posts
    175
    Actually I want to keep the same master/detail relationship between the two forms but because the subform has so many fields I now want to have it appearing in another window (rather than have the users scrolling too much) when a button is pressed in the main form.

  4. #4
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    i'm not sure if this will work but you could add some code to the subforms source form that on a button click or other event sends the data back to the orgininal or in the main form that send data to subform and requeries it.

    ie
    Code:
    Form_x.field.value = Form_y.field.Value
    Form_x.Requery
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

  5. #5
    Join Date
    Nov 2002
    Posts
    9
    Or have you tried the PageBreak control?

    Place it towards the centre of the subform (where it makes sense for a break to occur) the user can then press the Page Up and Page Down keys to access the sections of the subform. More than one PageBreak can be used. This may help avoid the confusion of too many forms doing the same thing, which can also be a hazzard from a design point of view.

    Ed

  6. #6
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173
    The issue that you will encounter if you open a second form with only some fields on one subform while the others on a "pop up Form" is an editing issue.

    Access will see this as two separate changes made to the one record at the same time, hence when you close the pop-up you will get a "some one else has changed this record "... type error and prompt you to drop changes or dopy to clipboard.

    This requires a fair amount of code to ensure that this would not happen.

    If the reason you are doing this is because there are too many fields, use a multipage for your subform and this will allow for users to move from one tab to another filing in information.

    Just add a next/prev button on each tab.

    Will send a sample this arvo once I manage to dig it up.


    Originally posted by m.timoney
    i'm not sure if this will work but you could add some code to the subforms source form that on a button click or other event sends the data back to the orgininal or in the main form that send data to subform and requeries it.

    ie
    Code:
    Form_x.field.value = Form_y.field.Value
    Form_x.Requery

  7. #7
    Join Date
    Sep 2001
    Posts
    175
    Maybe initially I did not make myself clear. Instead of having the main form and subform appearing in one form, I want to separate them into two forms with a button on the main form to open the subform (in a separate window) so that users can enter detail info. I am trying not to have to re-create the detail form as it has alot to fields etc.

  8. #8
    Join Date
    Nov 2002
    Posts
    9

    Talking

    Remove the subform from the main form. Create a button on the main form to open the form that used to be the subform. (docmd.OpenForm "MyForm" in the OnClick Event of the new button)

    If there is any code on the main form that refers to the subform, or on the subform that refers to the main form, then you would obviously have to make modifications to the code to get the results you need.

    If the (former) subform and the main form have data fields bound to the same table then you will most likely get the error message that Mona referred to ("some one else has changed this record "... ). If they are from two different tables that have referential integrity set up, then the master table data would need to be entered and saved prior to the child table data being entered. You may run into more issues along this line, but not knowing the design of your app, it's hard to guess what might happen.

    If the above solution makes sense to what you are trying to accomplish, then go ahead an use it (it may be a good idea to make a copy of your app first, before doing a bunch of experimenting - at least that way you will have a copy of where it is now to fall back on). If it works, great. If not then we can go from there.

    Ed

  9. #9
    Join Date
    Sep 2002
    Location
    Land of OZ
    Posts
    173
    Just delete the subform from the main form ... the form should still exist in the database.

    Add button to main form that calls the subform (use the wizard to do this).

    Only issues that you may encounter is that if there is any code that refers to the subform in the main form will need to be changes to ensure that the form name is correct.


    Originally posted by toukey1
    Maybe initially I did not make myself clear. Instead of having the main form and subform appearing in one form, I want to separate them into two forms with a button on the main form to open the subform (in a separate window) so that users can enter detail info. I am trying not to have to re-create the detail form as it has alot to fields etc.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •