• Update a records in a subform

    Author
    Topic
    #352663

    I am a learning user and need some help! I am using a combo box and 2 calendars (BeginDate) and (EndDate) to show records in a subform that meet the selected criteria. After viewing the records, if I change one or both of the dates, I have to click in the combo box or subform to get the new records to display. How can I make the subform automatically show the new records upon changing the date?

    Viewing 0 reply threads
    Author
    Replies
    • #513613

      In the Lost Focus event, add an event procedure which reads:

      Refresh

      That should do it.. I think.

      • #513631

        I strongly suggest you use the Requery Method of the subform.

        Refresh is designed for Multi-User situations where you want to see the information updated for the current recordset being viewed when changed by you or others.

        From Microsoft Access Help:

        “The Refresh method shows only changes made to records in the current set. Since the Refresh method doesn’t actually requery the database, the current set won’t include records that have been added or exclude records that have been deleted since the database was last requeried. Nor will it exclude records that no longer satisfy the criteria of the query or filter. To requery the database, use the Requery method. When the record source for a form is requeried, the current set of records will accurately reflect all data in the record source.”

        HTH

        • #513804

          I need some more info on how to do this. I am a new user and “just learning the ropes.” Any more specific info would be greatly appreciated. Thanks.

          • #513812

            I would use the after_update event in both combo boxes and I would put in the following:

            Forms![MasterForm Name]![SubForm Name].Form.Requery

            You could use the lost focus, but if you haven’t changed anything it will do extra processing (only makes a difference in a large query).

            If you ever want to know what event happens when, I test by putting a msgbox action in the event so that when the message appears I know the event occurs at that point.

    Viewing 0 reply threads
    Reply To: Update a records in a subform

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: