Page 1 of 4 1234 LastLast
Results 1 to 15 of 58
  1. #1
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77

    Question Question: Master Form with Multiple Subforms Problem

    I am new to this forum, but I am very glad to be here.

    I'm needing some help with the design of my database. The primary table has a total of six relationships with other tables: three one to many, and three many to many joined with junction tables.

    Where I'm struggling is the creation of my master form. The three one to many relationships will be represented with combo boxes; all the records will be created on their own forms. But the three other many to many tables are causing issues for my main form. I want to use subforms where the user will create the records for these tables as they complete the master form.

    I think my main issue is the how to link the records created in the subform to the primary table while in the master form.

    I know my master form should be based on a query, but I'm also having trouble designing the correct query for it.

    I'm willing to provide a copy of my DB if needed.



    I'd appreciate any assistance you can provide.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Form/subform arrangement for properly structured db should be quite simple. Follow instructions at bottom of my post to provide db. I will be able to review it after Feb 22.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    I've attached a copy of my Db for you to review, June7.

    I appreciate your time reviewing my Db.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Forms can be bound to tables or queries.

    Explain your data some more. Can a rejected application be related to: Multiple applicants? Multiple vehicles? Multiple reasons? Shouldn't an application (rejected or otherwise) be for a single vehicle/applicant?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    A single rejected application can have more than one applicant, and a single application can have multiple reasons for rejection. It is not absolutely necessary to use a single rejected application for more than one vehicle, but it would be useful.

    I want to develop the database for users to produce customized letters/reports.

    I've struggled on creating a master form for users to record: vehicle info, applicant(s) info, and rejection reason(s).

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The master form should be set up with a subform for each of the junction tables. A combobox on each subform for selecting vehicle, applicant, reason. If vehicle or applicant or reason not in the combobox list then use the NotInList event to open a form to add the new record then requery the combobox and new record will be available as an item in the combobox.

    Here is one tutorial http://www.blueclaw-db.com/access_no...ed_example.htm
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    Well it is reassuring that I at least have got the design of my tables correct.

    And that notinlist event sounds like the ticket. I'll test it when I get the chance on Monday.

    One thing I'm struggling with is whether or not to make the master form bound to a table or a query. How will I know which is best?

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If you want to filter the form's recordset (such as to exclude 'closed' records) or define sort order, a query is appropriate. However, the form has properties that can define filter and sort order so that is even possible with table as RecordSource. Consider that the form properties can be modified with code so the limitation to exclude 'closed' records might be superseded. However, if this restriction is a hard-code parameter in the query, then it will persist even if code sets the form filter property to further filter the form's RecordSet.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    I'm trying to implement what you suggested, but I'm having issues understanding how to use this code in my Db. I'm having difficulty understanding what field names, form names, control names from my Db should replace the example code. I have limited experience with VB code; I can't recognize what I'm supposed to change in the code for my use.

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    What exactly are you stuck on? Let's deal with one thing at a time.

    1. set up the form/subform arrangement

    2. set up comboboxes on subforms to select vehicle, applicant, reason

    3. figure out code for the NotInList event
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    That's a good idea.

    I've created a main form and a subform. The main form is based on the Rejected_Application_Tbl, and the subform has a record source of the Vehicle_Junction_Tbl (I'm taking these subforms and comboboxes one at a time).

    When I setup the combobox on the subform, the wizard presents me with three options: A.) I want the combo box to look up the values in a table or query. B.) I will type in the values that I want. C.) Find a record on my form based on the value I selected in my combo box.

    No sure which to select, but If I had to guess it would be A.

  12. #12
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Did you test adding records via the form/subform setup?

    Go with A. The values will come from the vehicle, applicant, reason tables.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    Yes, I have tested adding records, and it works. That is, if I add a record directly into the Vehicle_Tbl, I can select it in the subform of the main form. That links the records.

    If I attempt to add a new record on the main form in the Vehicle_Junction_SubFrm, the following message appears: "You cannot add or change a record because a related record is required in table 'Vehicle_Tbl'."

    Is the message that should be appearing at this point since we have not added the VB code for the subform?

    If so, I'm ready for assistance with the VB code.

  14. #14
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    No, you should be able to add records without code. Forms must not be set up properly. Here is a tutorial about form/subform http://office.microsoft.com/en-us/ac...010098674.aspx

    The comboboxes NotInList event code is an unrelated issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  15. #15
    KCC47 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    77
    I believe I have followed these instructions, but it continues to show that message.

    Would you mind taking a look at my DB again?
    Attached Files Attached Files

Page 1 of 4 1234 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 06-20-2012, 12:00 PM
  2. Linking Subforms on Unbound Master Form?
    By 10 Gauge in forum Forms
    Replies: 8
    Last Post: 07-21-2011, 08:06 AM
  3. Replies: 22
    Last Post: 03-15-2011, 07:17 AM
  4. Master/Child between Subforms
    By Pilotwings_64 in forum Forms
    Replies: 3
    Last Post: 08-22-2010, 01:45 AM
  5. Replies: 2
    Last Post: 06-14-2010, 03:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums