| **Navigation:**  [[abc library reference.htm|ABC Library Reference]] > FileManager > FileManager Methods >====== RestoreFile (restore a previously saved file state) {{c6h0009.jpg|C6H0009.jpg}} ====== | [[restorebuffer restore a previously saved record buffer .htm|{{btn_prev_n.gif|Previous page}}]][[abc library reference.htm|{{btn_home_n.gif|Return to chapter overview}}]][[savebuffer save a copy of the record buffer .htm|{{btn_next_n.gif|Next page}}]] | | || **RestoreFile( **//filestateid,dorestore //**)** {{blk2blue.jpg|blk2blue.jpg}} | **RestoreFile** | Restores a previously saved file state. | | //filestateid// | A USHORT returned by the SaveFile method that identifies the file state to restore. | | //dorestore// | An boolean integer constant, variable, EQUATE, or expression to indicate whether or not to perform the restoration. If omitted, the default of TRUE (1) is implied. | The **RestoreFile **method restores the specified file state for the managed file. RestoreFile restores from states previously saved by the SaveFile method. **Implementation:** The RestoreFile method restores file position, as well as any active HOLD or WATCH. RestoreFile calls the RestoreBuffer method to restore the managed file's record buffer contents. **Example:** **SaveState USHORT               !must be a USHORT** ** CODE** ** SaveState = Access:MyFile.SaveFile()  !save the file state** ** SET(MyKey,MyKey)              !access the file (change the file state)** ** LOOP UNTIL Access:MyFile.Next()** **  !Check range limits here** **  !Process the record here** ** END** ** Access:MyFile.RestoreFile(SaveState)  !restore the previously saved file state** **See Also:**     [[savefile save the current file state .htm|SaveFile]], [[restorebuffer restore a previously saved record buffer .htm|RestoreBuffer]]