Tuesday, June 26, 2018

Requery or refresh data

Requery or refresh data

When you share a database over a network, Microsoft Access updates the information at set intervals. To view the most current data, refresh the records from either Datasheet or Form view, on the Home tab, click Refresh All >Refresh. The refresh process updates the existing data in a datasheet or form, and doesn't reorder records, display new records, or remove any deleted records or records that no longer meet specified criteria. For a more specific or a thorough update, use a macro to requery the data.

Note:  Running the requery process can be time consuming depending on the size of the recordset.

What do you want to do?

Set the refresh interval

Manually requery data

Requery data in a client database

Requery data in an Access app

Set the refresh interval

By default, Access refreshes data every 60 seconds but here's how you can set the refresh interval:

  1. Under File, click Options > Client Settings.

  2. Under Advanced, change the settings for Refresh interval (sec).

Top of Page

Manually requery data

  • Press SHIFT+F9.

Top of Page

Requery data in a client database

You can create a macro and attach it to the event to have the data requery automatically whenever an event occurs. For example, to requery the data in a form whenever the form receives the focus. You could create a macro and attach it to the form's On Got Focus event, by using the following procedure:

  1. On the Create tab, click Macro. If this command is unavailable, click either Module or Class Module, and then click Macro.

  2. Click the arrow in the box beside the green plus symbol (+), and select Requery.

  3. Save the macro and close the Macro Builder.

  4. Open the form that you want in Design view. If the property sheet is not displayed, press F4.

  5. With the form selected, on the property sheet, click the Event tab.

  6. On the Event tab, click the arrow in the On Got Focus property, and then click the name of the macro — Requery.

  7. Save the form.

Top of Page

Requery data in an Access app

Access app queries run on the server. You would use the RequeryRecords macro to requery data in an Access app. This macro requires the current recordset.

  1. Open the form that you want, click Actions, and then click On Current.

  2. From the Action Catalog, click RequeryRecords. If you choose to leave blank the Where=, no additional filtering is performed on the results and by leaving the OrderBy= as blank, no specific sorting is performed.

  3. Save the form.

Top of Page

No comments:

Post a Comment