1 / 17

Understanding DAO Objects and Database Manipulation in VB

Learn to manipulate databases using DAO objects and methods in Visual Basic. Work with Recordsets and QueryDefs to access and modify data efficiently.

thibaultr
Download Presentation

Understanding DAO Objects and Database Manipulation in VB

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Data Access Objects 

  2. DBEngine Object • The DBEngine object contains and controls all other objects in the hierarchy of DAO objects.

  3. DBEngine Object-Methods

  4. DBEngine Object-Properties

  5. Database object • You use the Database object and its methods and properties to manipulate an open database.

  6. Database object-Methods

  7. Database object-Properties

  8. Recordset object-Methods A Recordset object represents the records in a base table or the records that result from running a query.

  9. Recordset object-Methods

  10. Recordset object-Properties

  11. RecordsetTypeEnum Enumeration

  12. Function FindRecordCount(strSQL As String) As Long Dim dbsNorthwind As DAO.Database Dim rstRecords As DAO.Recordset On Error GoTo ErrorHandler Set dbsNorthwind = CurrentDb Set rstRecords = dbsNorthwind.OpenRecordset(strSQL) If rstRecords.EOF Then FindRecordCount = 0 Else rstRecords.MoveLast FindRecordCount = rstRecords.RecordCount End If rstRecords.Close dbsNorthwind.Close Set rstRecords = Nothing Set dbsNorthwind = Nothing Exit Function ErrorHandler: MsgBox "Error #: " & Err.Number & vbCrLf & vbCrLf & Err.Description End Function

  13. Dim dbsNorthwind As DAO.Database Dim rstEmployees As DAO.Recordset Set dbsNorthwind = CurrentDb Set rstEmployees = dbsNorthwind.OpenRecordset("Employees") rstEmployees.MoveFirst Do Until rstEmployees.EOF If rstEmployees!Title = "Sales Representative" Then rstEmployees.Edit rstEmployees!Title = "Account Executive" rstEmployees.Update End If rstEmployees.MoveNext Loop

  14. QueryDef object-Methods A QueryDef object is a stored definition of a query in a Microsoft Access database engine database.

  15. QueryDef object-Properties

  16. TableDef object-Methods • A TableDef object represents the stored definition of a base table or a linked table (Microsoft Access workspaces only).

  17. TableDef object-Properties

More Related