Using Code to Refresh or Requery

In this section, you'll see how to requery by using code. The Requery method makes sure that the user gets to see any changes to existing records as well as any added records. It also ensures that deleted records are removed from the recordset. It's easiest to understand the Requery method by looking at the data underlying a form:

Private Sub cmdRequery_Click()
   If Me.RecordsetClone.Restartable Then
      Me.RecordsetClone.Requery
   Else
      MsgBox "Requery Method Not Supported on this Recordset"
   End If
End Sub

This code first tests the Restartable property of the recordset underlying the form. If the Restartable property is True, the recordset supports the Requery method that's performed on the form's recordset. Of course, ...

Get Alison Balter's Mastering Access 2002 Enterprise Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.