Recordset.Restartable プロパティ (DAO)

適用先: Access 2013、Office 2013

Recordset オブジェクトの基になるクエリを再実行する Requery メソッドを、 Recordset オブジェクトがサポートするかどうかを示す値を取得します。

構文

式 。再起動

expression: Recordset オブジェクトを表す変数。

注釈

テーブル タイプの Recordset オブジェクトは、常に False を返します。

Recordset オブジェクトに対して Requery メソッドを使用する前に、 Restartable プロパティを確認します。 そのオブジェクトの Restartable プロパティが False に設定されている場合は、基になる QueryDef オブジェクトの OpenRecordset メソッドを使用してクエリを再実行します。

例

以下の例は、さまざまな Recordset オブジェクトの Restartable プロパティの機能を示します。

    Sub RestartableX() 
     
     Dim dbsNorthwind As Database 
     Dim rstTemp As Recordset 
     
     Set dbsNorthwind = OpenDatabase("Northwind.mdb") 
     
     With dbsNorthwind 
     ' Open a table-type Recordset and print its 
     ' Restartable property. 
     Set rstTemp = .OpenRecordset("Employees", dbOpenTable) 
     Debug.Print _ 
     "Table-type recordset from Employees table" 
     Debug.Print " Restartable = " & rstTemp.Restartable 
     rstTemp.Close 
     
     ' Open a Recordset from an SQL statement and print its 
     ' Restartable property. 
     Set rstTemp = _ 
     .OpenRecordset("SELECT * FROM Employees") 
     Debug.Print "Recordset based on SQL statement" 
     Debug.Print " Restartable = " & rstTemp.Restartable 
     rstTemp.Close 
     
     ' Open a Recordset from a saved QueryDef object and 
     ' print its Restartable property. 
     Set rstTemp = .OpenRecordset("Current Product List") 
     Debug.Print _ 
     "Recordset based on permanent QueryDef (" & _ 
     rstTemp.Name & ")" 
     Debug.Print " Restartable = " & rstTemp.Restartable 
     rstTemp.Close 
     
     .Close 
     End With 
     
    End Sub