Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jan 2001
    Location
    Virginia
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update a records in a subform

    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?

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Northern, California, USA
    Posts
    1,886
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a records in a subform

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

    Refresh

    That should do it.. I think.
    <IMG SRC=http://www.wopr.com/w3tuserpics/Kel_sig.gif>
    Moderator:<font color=448800> Pix Place, Internet Explorer</font color=448800>
    <small>www.kvisions.com

  3. #3
    2 Star Lounger
    Join Date
    Dec 2000
    Posts
    188
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a records in a subform

    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

  4. #4
    Lounger
    Join Date
    Jan 2001
    Location
    Virginia
    Posts
    37
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a records in a subform

    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.

  5. #5
    Star Lounger
    Join Date
    Feb 2001
    Location
    Wirral, Merseyside, Merseyside, England
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a records in a subform

    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.

Posting Permissions

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