Working with database in code: – In addition to using the data controls navigation button, we may write to navigate the records in a database. Then we can make the data control invisible by setting its property to false and providing other means for the user to navigate the records in the database.

The data control creates an object called record set to hold the records in a database table. the record set object provides several method and properties that may be use to navigate and manipulate the database in code. The data control has a property called record set, which is reference to its record set. The methods are MoveFirst, MoveNext, MovePrevious, MoveLast, Find, Update, AddNew, Delete, EOF, BOF and Bookmark.

  1. MoveFirst: – This method used to display first record on the form. This method works like first record button.
  2. MoveNext: – This method is use to display next record on screen from current record. If current record is a last record, it cannot move. The move next method works like the next record button.
  3. MovePrevious: – This method is used to display previous record in the table from current record position. If current record is first record, it cannot move. This method works like the previous record button.
  4. MoveLast: – This method is used to display last record of table on screen. The move last method works like the last record button.
  5. Find: – This method is used for search a record that matches a search condition. Only one record can be searched at a time using find method.
  6. Update: – This method is use to saves a new record or an edited or deleted records in the table. after updating records, previous position cannot find.
  7. AddNew: – This method is used to append a blank record at the end of the existing table.
  8. Delete: – This method is used to delete current record from existing table.
  9. EOF: – This method is used for record pointer. It set to true when the current record has moved beyond the last record in the existing table.
  10. BOF: – This method is used for beginning of file. It set to true when the current record has moved before the first record in the exiting table.
  11. Bookmark: – This method holds the current records location.
Advertisements