Results 1 to 7 of 7
  1. #1
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subforms (Access 2000)

    I have a form that has multiple subforms. The subforms have default entries. My problem is that unless you physically click on the subform it does not open nor save a record to the source table. How do I get the child forms to open and record the default data at the same time the parent form opens.

  2. #2
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Subforms (Access 2000)

    I think we're going to need more info to answer your question. It appears that you are trying to add records to several tables at the same time by using subforms. What is it that causes records to be added? Is it simply viewing a record from the main form? Or is it the creation of a new record on the main form? Does every record in the main table have a record in each of the sub-tables? If so you may want to look at using a query and not using subforms. Usually subform tables have a many-to-one relationship with the main table.
    Wendell

  3. #3
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subforms (Access 2000)

    You are correct I want to add records to several tables at the same time. The Parent form is sourced by the General Information Table(ie Name, Date, Record Number etc) Each subform is sourced by a seperate table, as the subform opens it inherits the record number form the parent form which becomes the relationship. A Value is then selected using an option box which inserts a value into the child forms source table. Now to the problem, when I open the parent form, the subforms are avialble but do not take any values till an option is selected, when an option is clicked/selected a record is added to the secondary table with the record ID from the parent form/table and the value selected by the Option Frame. What I want to happen is : When the form is opened I want all of the subforms to load/open( I don't know the correct term) add the record with the record ID from the parent form and a default value from the child form to the the secondary table even if an option is not clicked on.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Subforms (Access 2000)

    It doesn't work that way, and properly so. You do NOT want to create a bunch of records in those secondary tables that contain nothing but the parent record ID, which is what would have to happen to make it work the way you want. Maintaing that mess would be a huge job. The general rule of thumb is that you only create records when they are needed. If you *need* to create all those records after you make an option selection, you can do it in code by creating and executing a series of SQL statements and then requerying the subforms to display the new records.
    Charlotte

  5. #5
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subforms (Access 2000)

    I agree with you 100%. However the powers to be have given the person who uses this check list to have the answers defaulted and change what needs to be changed. So I was over ridden. Now, I have to make it happen which is to create these records by default. What I need to know is ; what is the code I need? Is it "docommand open subform and option box= value" or something else? and can I do a case or a switch with the code? There is 45 on one form and 90 on the other, a lot of typing I would rather avoid.

  6. #6
    Super Moderator
    Join Date
    Aug 2001
    Location
    Evergreen, CO, USA
    Posts
    6,624
    Thanks
    3
    Thanked 60 Times in 60 Posts

    Re: Subforms (Access 2000)

    Seeing your email address, I understand what you meant about "the powers to be" <img src=/S/grin.gif border=0 alt=grin width=15 height=15> - but they are forcing you to do some really complex programming. I wouldn't normally suggest putting 90 binary checkboxes on a form, but 90 subforms would drive me over the wall.

    In order to do what your describe, you would have to set the focus to each one of the subforms and execute some code to set the default. This kind of structure stretches Access close to some of the theoretical limits in terms of form design, so I would start getting real nervous. As I indicated above, I would look at not using subforms at all, which lets me set the default values on the form directly. Is there some reason why each response needs to go in its own table? If not, you simply have a form with a table as it's basic data source. It appears you have a challenge ahead of you.
    Wendell

  7. #7
    2 Star Lounger
    Join Date
    Jun 2001
    Location
    Kenton, Delaware, USA
    Posts
    107
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Subforms (Access 2000)

    I designed the forms awhile back, the reason for the separate tables has to do with analyizing each item as a stand alone with who is responsible, why they are responsible etc. Actually the whole thing works "relatively" smooth. Now the end user has gotten (hmmm,,,what is the phrase I am looking for? ahh yes) spoiled. And wants to be able to only have to make entries where something is not true or is not applicable. So I will go back and redesign the form as one table and then do the split outs with appends from there. Actually that would have been the smarter way to go from the beginning. Well live and learn. Thanks for the look see anyway.

Posting Permissions

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