Multiple subforms to one parent form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • louisjones
    New Member
    • Mar 2008
    • 5

    Multiple subforms to one parent form

    Please help!

    I'm new to this but I'll try and be as clear as possible... I have a table tblCase with an autonumber key field CaseID. I have four other tables each having a many-to-one relationship to CaseID.

    There is a form for each table and I’m trying to have the four subforms open from buttons within the parent form. Is this actually possible? I have been able to create a parent form with four subforms actually within, but it is too large and impractical. I know you can open one subform from a button as it is an option in the Wizard. I did try to open the subforms with command buttons stating that the caseID fields had to be the same in both but then I can not add new records.

    Any help would be really appreciated, I've only been using Access a few months and other posts on this site have already been invaluable.

    Thanks
  • orangeCat
    New Member
    • Dec 2007
    • 83

    #2
    Originally posted by louisjones
    Please help!

    I'm new to this but I'll try and be as clear as possible... I have a table tblCase with an autonumber key field CaseID. I have four other tables each having a many-to-one relationship to CaseID.

    There is a form for each table and I’m trying to have the four subforms open from buttons within the parent form. Is this actually possible? I have been able to create a parent form with four subforms actually within, but it is too large and impractical. I know you can open one subform from a button as it is an option in the Wizard. I did try to open the subforms with command buttons stating that the caseID fields had to be the same in both but then I can not add new records.

    Any help would be really appreciated, I've only been using Access a few months and other posts on this site have already been invaluable.

    Thanks
    You may wish to look at this site.
    Form_SubForm_St uff
    near page 5-24 or so for some of the rationale and tips.

    Comment

    • louisjones
      New Member
      • Mar 2008
      • 5

      #3
      Thanks for the help, but ideally I dont want all of the subforms 'open' on the main form; I want command buttons to open them in stand alone windows. Any ideas?

      Comment

      • solom190
        New Member
        • Oct 2008
        • 5

        #4
        Originally posted by louisjones
        Thanks for the help, but ideally I dont want all of the subforms 'open' on the main form; I want command buttons to open them in stand alone windows. Any ideas?
        Did you ever figure out the solution to this problem? I am trying to do the exact same thing. Only problem I am having is when putting information into the stand-alone forms the foriegn key value (in the underlying table) that is in subform does not get populated with the primary key value of the parent form that entered before opening the subform. I used this code:

        Code:
        Private Sub Command52_Click()
        On Error GoTo Err_Command52_Click
        
            Dim stDocName As String
            Dim stLinkCriteria As String
        
            stDocName = "frmHearings"
            
            stLinkCriteria = "[CaseNo]=" & "'" & Me![CaseNo] & "'"
            DoCmd.OpenForm stDocName, , , stLinkCriteria
        
        Exit_Command52_Click:
            Exit Sub
        
        Err_Command52_Click:
            MsgBox Err.Description
            Resume Exit_Command52_Click
            
        End Sub
        to filter the informtion that appears in the subform and it does filter the information if I manually type in the matching, in my case "CaseNo" in the "Hearing" table but it shouldn't work like that. I want the foreign key field in that "Hearing" table to be automatically populated, on the table level, with the primary key value of the parent form. Can you or anyone else lend some assistance? I have been racking my brain for a few days trying to get this and I am drawing complete blanks.

        Comment

        • solom190
          New Member
          • Oct 2008
          • 5

          #5
          FYI:
          I can't use tabs to fix this problem because I do not have enough space to work with screen-wise.

          Comment

          Working...