• Refresh record – Access 2007

    Author
    Topic
    #480760

    After using a combobox to make a selection the corresponding data only shows after pressing F5.
    The combobox is in the form header and the corresponding data is in the form detail.
    Only one table is used.
    Anybody knows how to set this up using VBA?

    Thanks for the reply.
    Joop

    Viewing 3 reply threads
    Author
    Replies
    • #1312620

      Joop,

      Try: Forms![B]YourFormNameHere[/B].Refresh in the ComboBox AfterUpdate Event. :cheers:

      May the Forces of good computing be with you!

      RG

      PowerShell & VBA Rule!
      Computer Specs

    • #1312621

      After using a combobox to make a selection the corresponding data only shows after pressing F5.
      The combobox is in the form header and the corresponding data is in the form detail.
      Only one table is used.
      Anybody knows how to set this up using VBA?

      Thanks for the reply.
      Joop

      What is the recordsource for the form? Does it reference the combobox to select a record? If so, then all you need is this in combobox’s AfterUpdate event:

      Me.Requery

      Note that there is a difference between Requery and Refresh. Requery reruns the query; Refresh doesn’t rerun the requery, it just gets the latest data for each record originally returned.

    • #1312710

      Thanks gents for the reply.
      I’ve tried me.refresh in the AfterUpdate event and it did not work. I’ll give it another try and try me.requery as well. Will revert.

      Thanks for pointing out the difference between refresh and requery.

      As already mentioned pressing F5 (assume this is refresh in access as well) showed the remaining record info.
      The refresh was not necessary when using Access 2000 for this database.
      Is there a particular reason refresh has to be used when using ACC2007?

      I noticed a refresh and refresh all option in ACC2007. Is this handled differently by code?

      Thanks for the reply.

      Joop

      • #1314922

        Joop, I use the following statement to update combo boxes and lists:
        .Rowsource = .Rowsource
        With the various versions of Access I work with, this is the only reliable method I have found to update a combo box or list. This requires a little VBA programming. You need to run the line whenever the event occurs that changes its underlying source data. For example, if I have a list with 2 combos and number 2 needs to get updated after something is selected in 1, I will put the rowsource=rowsource statement into the onClick event of Combo 1, i.e., combo2.rowsource=combo2.rowsource.
        Hope this helps,
        Kirk

    • #1315037

      Thanks Kirk,

      Will give it a try
      Joop

    Viewing 3 reply threads
    Reply To: Refresh record – Access 2007

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

    Your information: