Lecture 4 Manipulating Form Data using methods of Recordset and RecordsetClone in VBA Restrict data with filter 1 Rapid Application Development.

Slides:



Advertisements
Similar presentations
Basics of Database Programming with VB6
Advertisements

1 Migrating from Access to SQL Server Simon Kingston, CSU / NPS NRGIS.
1 Web-Enabled Decision Support Systems Access Introduction: Touring Access Prof. Name Position (123) University Name.
Microsoft Access Course 1. Introduction to the user interface.
Access Lesson 2 Creating a Database
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
1 Chapter 12 Working With Access 2000 on the Internet.
The ADO Data Control. Universal Data Access Open Database Connectivity (ODBC) –standard for accessing data in databases OLE-DB –allows access to data.
Using Visual Basic 6.0 to Create Web-Based Database Applications
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Using Objects and Properties
14 1 Chapter 14 Database Connectivity and Web Development Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Visual Basic Database Access BICS546. Microsoft Universal Data Access OLE DB: The OLE database protocol –Allows a program to access information in any.
Copyright 2003 : Ismail M.Romi, PPU. All Rights Reserved 1 Lab10 Interacting with Data (Database Management)
Database Programming (using ADO) Universal Data Access – Microsoft strategy for providing access to information across the enterprise. – UDA provides high-performance.
1 Chapter 8 Object-Based Programming in VBA. 8 Chapter Objectives Declare and use object variables Create procedures that use built-in form methods Find.
WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC BY V. V. SUBRAHMANYAM.
1 Client/Server Database Tutorial. SQL Server Connection through MS Access FACBUSAD1 SQL server MS Access MGD B106 Computer or your own PC Remote SQL.
Chapter 8 Relational Databases ActiveX Database Controls 8 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall, Inc. By Carlotta Eaton.
© 1999, by Que Education and Training, Chapter 11, pages of Introduction to Computer Programming with Visual Basic 6: A Problem-Solving Approach.
Microsoft Access Ervin Ha.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT ACCESS Lesson 3 – Creating and Modifying Forms.
Chapter 4: Organizing and Manipulating the Data in Databases
CHAPTER 9 DATABASE MANAGEMENT © Prepared By: Razif Razali.
Handling of data from multiple databases. Visual Basic Database Visual Basic application acts as a front-end to the database Visual Basic application.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. WORD 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 22 Macros.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
Using Visual Basic 6.0 to Create Web-Based Database Applications
DB Libraries: An Alternative to DBMS By Matt Stegman November 22, 2005.
1 Overview of Databases. 2 Content Databases Example: Access Structure Query language (SQL)
McGraw-Hill/Irwin Programming in Visual Basic 6.0 © 2002 The McGraw-Hill Companies, Inc. All rights reserved. Update Edition Chapter 11 Accessing Database.
Fundamentals of Database Chapter 7 Database Technologies.
Tutorial 10 by Sam ine1020 Introduction to Internet Engineering 1 Database & Server-side Scripting Tutorial 10.
File Processing Concepts – Field – combination of 1 or more characters that is the smallest unit of data to be accessed – Record – group of related fields.
Introduction to ADO Y.-H. Chen International College Ming-Chuan University Fall, 2004.
Key Applications Module Lesson 21 — Access Essentials
Access Manual 2 By Dhawala Kovuri Elham S.Khorasani Ismail Guneydas.
1 Microsoft Access Introduction – Tables and Forms ©Richard Goldman January 2000.
Office Management Tools II Ms Saima Gul. Office Management Tools II Ms Saima Gul.
What is database?  Any Method for access info into Application from DataBase?  ODBC is standard for Accessing Data.  Problem with ODBC:  Information.
How to Connect to Database ODBC (Open Database Connectivity) ADO (ActiveX Data Object) ASP Code To Connect to Database Recordset Object Navigating through.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 3 – Creating and Modifying Forms.
Tutorial 91 Databases A database is an organized collection of related information stored in a file on a disk A database allows companies to store information.
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 3 – Creating and Modifying Forms.
AVCE ICT – Unit 7 - Programming Session 16 – Database and VB.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Microsoft Access Lesson 5 Lexington Technology Center February 25, 2003 Bob Herring On the Web at
7-1 Active Server and ADO Colorado Technical University IT420 Tim Peterson.
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
1 ADO Activex Data Objects. 2 ADO ADO allows users to access data easily from many existing databases (such as Access or Paradox) From ODBC compliant.
Object-Oriented Application Development Using VB.NET 1 Chapter 13 Introduction to Data Access Classes and Persistence.
Lecture 3 Visual Basic for Applications in Access 1 Rapid Application Development.
Chapter 10 Using Macros, Controls and Visual Basic for Applications (VBA) with Excel Microsoft Excel 2013.
 2 Data Object Library approaches ◦ DAO (Data Access Objects)  Original access strategy (up to VB6)  Closely linked to MS Access ◦ ADO (ActiveX Data.
Visual Basic Database Access
Running a Forms Developer Application
آشنایی با نرم افزار Microsoft Access
ActiveX Data Objects (ADO)
Created by Kamila zhakupova
5. Using databases in VB.
ADO.NET Accessing Databases in VS.NET
Microsoft Office Access 2003
Microsoft Office Access 2003
VISUAL BASIC INTRODUCTION TO DATA CONNECTIVITY.
Chapter 10 ADO.
Unit – V Data Controls.
Presentation transcript:

Lecture 4 Manipulating Form Data using methods of Recordset and RecordsetClone in VBA Restrict data with filter 1 Rapid Application Development

2 Topics l The ADO & DAO object models l Recordset and RecordsetClone l Methods of the Recordset object l Manipulating the Recordset using the RecordsetClone property l Restrict data by setting filter via form property and VBA

3 Components of a Database Application l User-interface and application code nrequest database services via the Jet database engine l The Jet database engine ncontains a set of dynamic link library (DDL) files, including a query processor and a results processor. ntranslates application’s requests into physical operations on the DB files l Data Store nfile(s) contain the data base tables of different format ncould be local or remote User Interface Data Store Database Engine

4 Microsoft ADO & DAO object models (1/2) l Access offers two different object models to work with recordsets, which is object-oriented interface to access a data source. nDAO (Data Access Objects) nADO (ActiveX Data Objects). The DAO model l DAO works only with Access tables. l ADO, the newer of the two, works either with MS Access and other databases via ODBC

5 Microsoft ADO & DAO object models (2/2) l In order to use these object libraries in your application through VBA the libraries must be referenced l Visual Basic IDE, choose Tools\References from the VBA IDE menu, and select e.g. Microsoft ActiveX Data Objects 2.8 Library option. If you don’t see that one in your References dialog box, you’ll have to scroll down to find it. l Which library should be used? nThe default is best, which is Microsoft Office 12.0 Access database engine Object Library – the equivalent of DAO nunless you need moremore

6 ActiveX Data Objects (ADO) l Microsoft ActiveX Data Objects (ADO) enable your client applications to access and manipulate data from a variety of sources nMS Access tables nexternal data sources, such as o Oracle oMicrosoft SQL Server. l ADO supports key features for building client/server and Web- based applications.

7 Data Access Objects (DAO) l DAO is an object-oriented interface of the Jet database engine l Objects: ndata objects, e.g. odatabases otables ofields noperations on database objects, e.g. oopen/close a database omodify a table’s structure oadd/update/modify/delete onavigating operations

8 The DAO object Model

9 The Access form and the Recordset object l a data form is based on a recordset via the RecordSource property na table na query Record Source

10 The form’s RecordsetClone property l Question: How is a recordset accessed from within a VBA code? l Answer: Using the form’s RecordsetClone property nPoints to remember about RecordsetClone oIt is a property of the form oIt refers to the recordset object to which the form is bound u e.g. CUSTOMER table l Example: If Form1 is bound to the CUSTOMER table then Form1.RecordsetClone refers to the CUSTOMER table object nForm1.RecordsetClone.Recordcount returns to the number of records of the CUSTOMER table

11 Moving around a form’s RecordSource using its RecordsetClone property l Form1.RecordSetClone.MoveFirst l Form1.RecordSetClone.MoveNext l Form1.RecordSetClone.MoveLast l Form1.RecordSetClone.MovePrevious

12 Finding a specific record l The FIND methods can only be used for locating a record in a recordset of the dynaset or snapshot type. nFindFirst nFindNext nFindLast nFindPrevious l Example: Form1.RecordsetClone.FindFirst “CustNo = 5” l Using the SEEK method nused for table-type recordset nVB uses the table’s current index to seek for a value

13 Methods of the Recordset Object l AddNew nForm1.RecordsetClone.AddNew l Update nForm1.RecordsetClone.Update l Example: appending a blank record and assigning field values Form1.RecordsetClone. Addnew Form1.RecordsetClone.Fields(“CustNo”)=“1234” Form1.RecordsetClone.Fields(“CustName”)=“Smith” Form1.RecordsetClone. Update

14 Methods of the Recordset Object l Edit Form1.RecordsetClone. Edit Form1.RecordsetClone.Fields(“CustName”) = “Bloggs” Form1.RecordsetClone.Update l Delete the current record in a RecordSet nForm1.RecordsetClone.Delete A field name

15 Applying a filter on a form (1/3) l A filter can be applied on a form to view only a subset of records l Use the Form property window to set a filter condition

16 Applying a filter on a form (2/3) l When the form is running, the set filter can be applied by clicking Filtered/Unfiltered button at the bottom of the form

17 Applying a filter on a form (3/3) l Dynamic filter may be set using VBA code

18 Summary l The ADO & DAO object models l The Recordset Object and its methods l The form’s RecordsetClone property l Restrict data by setting filter