Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50

    Multiple items subform showing records selected in main form


    Hello all,

    I'm trying to set up a rather complicated form.

    In the main form, I have two cascading CombobBoxes. The first one lets the user choose a customer, the second one the projects between me and the customer.

    Now, I'd like to add a subform giving a list of Invoices with fields Date, Name and Amount. The list should only show the invoices related to the chosen customer and project.

    Moreover, I'd like to be able to add a new record in this list and this record should also make use of the choice of the project and customer in the main field.

    How do I do that?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Take it one step at a time. Where are you having a problem?

  3. #3
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50

    Some more details...

    Thanks for your reply.

    I have set up the two combo boxes and they work just fine.

    Then, I have set up the subform based on a query, where I have applied filters, e.g. Like [Forms]![frmAccount].[cboCust] &"*"
    The subform shows the correct reords, I can edit records.
    However, I can't add records.

    Benjamin

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Instead of using filters, let the LinkMaster/ChildFields properties of the SubForm control do the filtering for you. Your SubForm RecordSource should be generic and include all records.

  5. #5
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50
    This should be possible. Do I have to give Project and Customer in the subform again?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Your LinkMaster/ChildFields property can contain more than one field.

  7. #7
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50
    Another question, can I still use the query as data source?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Not your original query because it will probably not be updateable. Again, it should be generic and select all records.

  9. #9
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50
    Okay, I seem to come closer now to what I want.
    However, I have problems with this definition:

    Me!sfrmTL.LinkChildFields = "qryTL.lnkOEM, qryTL.txtProjectName"
    Me!sfrmTL.LinkMasterFields = "qryTL.lnkOEM, qryTL.txtProjectName"

    When I run the related ComboBox the first time, I get fields asking for the fields name values...

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do not inclute a table name with the field name. Why are you using code? I would put it is the properties in design view. It is static isn't it?

  11. #11
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50
    I get an error saying: "Can't built a link between unbound forms."

  12. #12
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Ahh...Haa!! Why are the form unbound?

  13. #13
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50
    There is no reason, I started with a blank one and, up to now, I never needed to add a record source...

    I guess, I have to take a step back and think about how to set up the master form properly (that was the unbounded, the subforms where all bounded to a query)

  14. #14
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You can set a control as a LinkMasterField if you want. You just need to use the correct syntax. http://access.mvps.org/access/forms/frm0031.htm

  15. #15
    schwabe is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jan 2012
    Location
    San Francisco Bay Area
    Posts
    50
    Hi Rural Guy,

    so, I have been able to set up the structure you suggested.

    In the main fraim I have the Project, Customer and Contact Name displayed with TextBoxes.
    In the subform I find for each Project the corresponding order timeline and I can step through all projects individually by using the record selectors at the bottom of the form. So far, so good

    What I'd like to be able to do next, is to select the project in the mainform with a combobox and all the other information should update automatically. How do I do this?

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

Similar Threads

  1. Replies: 16
    Last Post: 02-13-2012, 03:32 PM
  2. Replies: 12
    Last Post: 01-18-2012, 10:02 AM
  3. Subform requery after multiple records selected
    By AccessBlues in forum Forms
    Replies: 8
    Last Post: 08-04-2011, 11:03 AM
  4. Replies: 2
    Last Post: 07-10-2011, 07:22 PM
  5. Replies: 1
    Last Post: 10-13-2010, 12:40 PM

Tags for this Thread

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