Page 1 of 3 123 LastLast
Results 1 to 15 of 42
  1. #1
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48

    Form auto-updating from a query.

    I have a form that has a subform on it. The subform displays a separate form that is created from a query. Whenever the first form is open, the query uses THAT form's date as criteria, and then updates data in the query. The 2nd form is just a cleaned up collection of the data from that query.



    The original form has the 2nd form as a subform. So basically, is there a way to make it so, whenever that query runs...it automatically updates the 2nd form with the new information?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What causes the MainForm query to run?

  3. #3
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    Well let me think. I actually am not sure. Basically, the query just sits there. It's criteria pulls the date from the OPEN FORM. I was using the query as the content of the subform....which would work, because everytime the form opened, the subform would rerun the query, checking the open form date and it would be a working cycle. The problem was that the query format is cluttered and I just wanted the data, no record selectors, scroll bars, etc etc.

    So I made another form called "Query subform" that just displays the information from that query. And now the subform in the Main Form's content is the new form, instead of the query. The problem is, that the Query subform doesn't change. The values stay the same as the first time I ran the query...

    So how can I get it so the Query subform, automatically runs the query and updates the data in it everytime I open the Main form?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you set the LinkMaster/ChildFields properties of the SubFormControl yet?

  5. #5
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    No I have never messed with it. The subform itself is basically just holding content of a separate form. The separate form was made from the query. The problem is that the separate form does not update when the query reruns. So basically when the Form opens, I want the query to auto run, update the separate form, which will then be updated in the Main form's subform.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What is the name of your SubFormControl? Not the SubForm but the control on the MainForm that displays the SubForm.

  7. #7
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    Selected Meeting Roster

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    SubForms load *before* the MainForm so try putting this in the OnCurrent event of the MainForm:
    [Selected Meeting Roster].FORM.Requery

  9. #9
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    Nope, same results. If there is a requery expression....wouldn't it be better to put that in the actual "Subform"? Let me try and break it down by labeling them better...

    I have the MainForm. In the MainForm is a SubForm. The SubForm's content is a SecondForm. The SecondForm pulls information from a query I set up. The problem is, when I load the MainForm, the SecondForm inside the SubForm does not change according to the MainForm's date.

    Whenever the MainForm opens, I want the query to run in the background and update the SecondForm...which will then be updated inside the SubForm. So wouldn't I need a macro or expression on the SecondForm to requery when it is opened in the SubForm?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Why do you expect the SecondForm to change based on the MainForm's date?

  11. #11
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    The SecondForm is a form made from the query I set up. The query has criteria under the date column that will change the data depending on the date of the Open Form. The query updates just fine, but the SecondForm remains unchanged.

  12. #12
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    Basically I just want the SubForm to display the results of the query every time the MainForm opens. But if I did it just using the Query, it displays the information like a Table and has a lot of extra stuff taking up space. I can't get rid of the scrollbars, record selectors, etc etc.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    This query you set up is different from the RecordSource of your form, right?

  14. #14
    Guinea is offline Advanced Beginner
    Windows 7 Access 2007
    Join Date
    Aug 2010
    Posts
    48
    Yes, the RecordSource for the subform is the SecondForm. The recordsource for THAT SecondForm is the query.

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 Access 2007
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    OK, I didn't say that right. The mainForm has a RecordSource. Is it the same RecordSource as the "SecondForm"?

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

Similar Threads

  1. Auto updating table
    By forrestapi in forum Forms
    Replies: 1
    Last Post: 08-16-2010, 11:06 AM
  2. Updating using form bound to a query
    By onechriswhite in forum Forms
    Replies: 5
    Last Post: 07-25-2010, 04:04 AM
  3. Auto-updating fields in linked tables?
    By Leelers in forum Database Design
    Replies: 27
    Last Post: 01-08-2010, 06:23 PM
  4. Updating a query
    By bailey537 in forum Programming
    Replies: 1
    Last Post: 07-16-2009, 10:30 AM
  5. Auto updating a total
    By Dreamcatcher in forum Forms
    Replies: 0
    Last Post: 06-19-2009, 02:18 AM

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