Results 1 to 6 of 6
  1. #1
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Form with Subform (Access 2003)

    In the main form, I have a heading and a combo box where the users pick a customer name. When they pick the customer, I want all entries related to that customer to appear in datasheet form in the subform. The subform is based on a query where entries are grouped by customer. The form and subform are linked based on customer number.

    This form is an information screen - there is no input expected.

    Everything works fine as far as the correct entries appearing when the customers are selected from the combo box. However, I want the subform to appear blank until a customer is selected from the combo box. Currently, the subform is populates with the entries related to the first customer in the table.

    What do I have to do to start with a blank subform?

    Thanks for your help.

    Nancy

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form with Subform (Access 2003)

    There are several possibilities, but I'd like to know more about the design. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions.

  3. #3
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form with Subform (Access 2003)

    Hans, here is the file. Very stripped down. Still a work in process - I want to get the form and subform to work together before I make it "pretty."

    Thanks for any suggestions you may have.

    Nancy
    Attached Files Attached Files

  4. #4
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Form with Subform (Access 2003)

    Here is a modified version.

    Instead of using Master and Child fields to link the form and subform (although it is not actually a subform - it is just the query), I have changed the query to use the combo box as a parameter. The subform is then requeried in the after update event of the combo.

    I have also bound the main form to the Associations table, but unless you want to display some other fields it could be left as unbound. If you did that you could remove all the code about the bookmark.
    Attached Files Attached Files
    Regards
    John



  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Form with Subform (Access 2003)

    I have attached a version with a slightly different approach than John Hutchison's.
    I made the main form unbound, and set the Link Master Fields property of the subform on the mainform to cboAssociation, so that the subform is linked to the combo box. No code is needed at all.
    Attached Files Attached Files

  6. #6
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Minnesota, USA
    Posts
    151
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Form with Subform (Access 2003)

    Thank you both for your suggestions - they work perfectly for what I am trying to do.

    I apologize for being slow in responding; I was out of the office for a couple of days.

    Nancy

Posting Permissions

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