Using Objects and Properties

Slides:



Advertisements
Similar presentations
INTRODUCTORY MICROSOFT ACCESS Lesson 1 – Access Basics
Advertisements

1 Chapter 10 Protecting Data Integrity in a Multiuser Environment.
Tutorial 12: Enhancing Excel with Visual Basic for Applications
Microsoft Access Course 1. Introduction to the user interface.
1 Chapter 12 Working With Access 2000 on the Internet.
Access Tutorial 3 Maintaining and Querying a Database
1 Chapter 3 Reviewing Forms, Reports, and Data Access Pages.
VBA Modules, Functions, Variables, and Constants
Automating Tasks With Macros
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.
Automating Tasks With Macros. 2 Design a switchboard and dialog box for a graphical user interface Database developers interact directly with Access.
1 Chapter 4 The Fundamentals of VBA, Macros, and Command Bars.
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.
1 Chapter 2 Reviewing Tables and Queries. 2 Chapter Objectives Identify the steps required to develop an Access application Specify the characteristics.
1 Chapter 1 Tour of Access. 1 Chapter Objectives Start and exit Microsoft Access Open and run an Access application Identify the major elements of the.
Concepts of Database Management Sixth Edition
Chapter Extension 6 Using Microsoft Access © 2008 Pearson Prentice Hall, Experiencing MIS, David Kroenke.
Chapter Three Using Variables and Constants Programming with Microsoft Visual Basic th Edition.
Exploring Microsoft Excel 2002 Chapter 8 Chapter 8 Automating Repetitive Tasks: Macros and Visual Basic for Applications By Robert T. Grauer Maryann Barber.
Microsoft Access Ervin Ha.
Chapter 9 Macros, Navigation Forms, PivotTables, and PivotCharts
Chapter 8: String Manipulation
8 Copyright © 2004, Oracle. All rights reserved. Creating LOVs and Editors.
A First Program Using C#
Microsoft Access Intro Class 1 Database Concepts.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 1 – Access Basics.
Unit J: Creating a Database Microsoft Office Illustrated Fundamentals.
ASP.NET Programming with C# and SQL Server First Edition
Handling of data from multiple databases. Visual Basic Database Visual Basic application acts as a front-end to the database Visual Basic application.
1 Chapter 9 Writing, Testing, and Debugging Access Applications.
Tutorial 11 Using and Writing Visual Basic for Applications Code
Using Visual Basic 6.0 to Create Web-Based Database Applications
9 Chapter Nine Compiled Web Server Programs. 9 Chapter Objectives Learn about Common Gateway Interface (CGI) Create CGI programs that generate dynamic.
Automating Database Processing Chapter 6. Chapter Introduction Design and implement user-friendly menu – Called navigation form Macros – Automate repetitive.
Using Visual Basic for Applications (VBA) – Project 8.
Working with Numeric Variables (Unit 6) Visual Basic for Applications.
© 2008 The McGraw-Hill Companies, Inc. All rights reserved. ACCESS 2007 M I C R O S O F T ® THE PROFESSIONAL APPROACH S E R I E S Lesson 6 – Designing.
® Microsoft Office 2010 Access Tutorial 3 Maintaining and Querying a Database.
Key Applications Module Lesson 21 — Access Essentials
Concepts of Database Management Seventh Edition
Access Project 3 Notes. Introduction Maintaining the Database  Modifying the data to keep it up-to-date Restructure the Database  To change the database.
SESSION 3.1 This section covers using the query window in design view to create a query and sorting & filtering data while in a datasheet view. Microsoft.
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.
Exploring Microsoft Access Chapter 8 Creating More Powerful Applications: Introduction to VBA.
Microsoft Access 2013 ®® Tutorial 10 Automating Tasks with Macros.
Microsoft Access 2010 Chapter 8 Advanced Form Techniques.
Exploring Microsoft Access Chapter 1 Introduction to Microsoft Access: What Is A Database?
Maintaining a Database Access Project 3. 2 What is Database Maintenance ?  Maintaining a database means modifying the data to keep it up-to-date. This.
1/62 Introduction to and Using MS Access Database Management and Analysis Yunho Song.
Introduction to a Database Defining a database Database window in Access The six items in window: Tables, Queries Forms, Reports, Macros, Modules.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Microsoft FrontPage 2003 Illustrated Complete Integrating a Database with a Web Site.
INSERT BOOK COVER 1Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall. Exploring Getting Started with VBA for Microsoft Office 2010 by.
Advanced Repetition Structure and String Functions (Unit 10) Visual Basic for Applications.
Microsoft Access Database Creation and Management.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Programming with Microsoft Visual Basic th Edition
Understanding Visual Basic Fundamentals CHAPTER 13 Understanding Visual Basic Fundamentals.
Presentation on Database management Submitted To: Prof: Rutvi Sarang Submitted By: Dharmishtha A. Baria Roll:No:1(sem-3)
VOCAB REVIEW. A field that can be computed from other fields Calculated field Click for the answer Next Question.
Lecture 4 Manipulating Form Data using methods of Recordset and RecordsetClone in VBA Restrict data with filter 1 Rapid Application Development.
1 Chapter 6: Creating Oracle Data Block Forms. 2 Forms  Application with a graphical user interface that looks like a paper form  Used to insert, update,
Objectives Query for top values Create a parameter query
Microsoft Access 2003 Illustrated Complete
Chapter 7 Advanced Form Techniques
Exploring Microsoft® Access® 2016 Series Editor Mary Anne Poatsy
Chapter 8 Advanced SQL.
Unit J: Creating a Database
Unit – V Data Controls.
Presentation transcript:

Using Objects and Properties Chapter 5 Using Objects and Properties

Chapter Objectives Define and explain the roles of objects and properties in an Access database Describe the difference between Microsoft Access objects, Data Access Objects (DAO), and ActiveX Data Objects (ADO) Write dot and bang notation that retrieves and updates object properties in a macro and module Create a query with a criterion that references a control on a form

Chapter Objectives Modify the properties of a form through a macro or VBA statement Modify the properties of a linked table Create recordsets in a VBA procedure Find and describe properties related to many objects, including forms, reports, tables, commands, controls, fields, databases, and recordsets

The World According to Objects Each object has properties Data items that describe the objects Object characteristics: Can contain other objects Have methods Capabilities or procedures that the object can perform Related objects can be grouped

The World According to Objects A group of objects, called a subclass, is a subset of another group of objects, called a superclass Class inheritance Process when a new subclass is placed inside a superclass, objects within that subclass inherit the properties of the superclass

The World According to Objects Object-oriented development environment Uses objects that have the features just described Object-based development environment Supports object properties, object methods, collections, and objects that contain other objects

Objects and Collections in Access Three major categories of objects exist: Microsoft Access objects Created and maintained by Access programming environment Primarily relate to the user interface and modules DAO objects Created and managed by the Jet database engine Primarily involve objects related to data storage and retrieval TableDef and QueryDef objects are examples of DAO objects

Objects and Collections in Access Three major categories of objects exist (continued): ADO objects Similar to DAO objects Table object replaces the TableDef object used in DAO and the Command object replaces the QueryDef DAO object

Objects and Collections in Access An object that contains related objects Tables collection Contains definitions of all Table objects Forms collection Contains all open forms; all forms that are loaded

Objects and Collections in Access Each TableDef object owns a Fields collection that in turn contains the Fields objects in the table Each Form object owns a Controls collection that contains all of the controls in the form Count property of a collection Indicates the number of objects in the collection

Objects and Collections in Access Figure 5-1 Some of the relationships among Microsoft Access objects

Objects and Collections in Access Figure 5-2 Relationships among DAO objects

Objects and Collections in Access Figure 5-3 Relationships among ADO objects

Objects and Properties in Access Dot notation Syntax used by VBA, macros, and queries Uses the dot (.) operator to indicate that what follows is an item defined by Microsoft Access Bang notation Notation using the exclamation point (!) Can be used in place of dot notation when the collection referenced by an object is the default collection

Objects and Collections in Access Keywords can be used to shorten object property paths VBA can use the word Me inside a form or report class module to refer to the form or report that contains the module A form or report class module can use the word Parent to refer to a form or report that contains another form or report

Changing Property Values VBA can change the value of a property by using the assignment statement in a VBA procedure VBA supports several data types: Integer is a relatively small integer Long is a larger integer Single is a real number

Changing Property Values VBA supports several data types (cont.): Double is a real number that offers twice as much storage space and precision as a Single String is a series of characters or numbers Boolean is True or False Variant can contain anything

Changing Property Values Table 5-1 Microsoft Access objects

Changing Property Values The SetValue action requires two action arguments: Item argument Contains the dot or bang notation that identifies the property Expression argument Contains the new value

Changing Property Values Figure 5-5 Macro action that shows a form’s Form Header

The Application Object and Properties Represents the Access application that is currently running MenuBar Identified the default menu that will be displayed when the application opens Intrinsic constant Name used by Access to represent a particular integer

The Application Object and Properties Table 5-2 Some Application object properties

The Screen Object and Properties Refers to the form, report, or control that is currently active on the screen Some screen properties are read-only Macros and VBA statements can read the current value but cannot change it

The Screen Object and Properties Table 5-3 Important Screen properties

Objects and Properties Related to Forms, Reports, and Controls Table 5-4 Commonly used properties associated with format or appearance

Objects and Properties Related to Forms, Reports, and Controls Table 5-5 Commonly used properties associated with updating data

Objects and Properties Related to Forms, Reports, and Controls Table 5-5 Commonly used properties associated with updating data (continued)

Objects and Properties Related to Forms, Reports, and Controls Caption property Displays text in the title bar of the form AllowAdditions A False setting prohibits the entry of new records Filter property When the FilterOn property equals True, the Filter property restricts the rows that the form displays to those rows that meet the criteria

Manipulating Record Sources and Row Sources Specifies a table or query that contains the values listed in combo or list box Record source Identifies table or query that supplies data to the entire form, page, or report Changing the value of a record source or row source in a module or macro changes the data displayed by the form, page, report, combo box, or list box

Nuances of Forms, Reports, and Controls Notation When the Modal property of a form is True, a user cannot perform an operation on any other form until the current, or modal, form is closed When the PopUp property of a form property is True, Access places the current form in front of all other open forms

Nuances of Forms, Reports, and Controls Notation Figure 5-6 Creating a hierarchical sequence of combo boxes

Data Access Objects and Their Properties Table 5-6 Commonly used DAO objects

Data Access Objects and Their Properties Table 5-6 Commonly used DAO objects (continued)

DBEngine, Workspace, and the Database Objects Represents an open database and is managed within the context of a Workspace Workspace object Defines how an application interacts with data Database engine (DBEngine object) Manages workspaces Compromises the built-in procedures that retrieve and update data in response to a user’s request

ActiveX Data Objects and Properties ActiveX Data Objects model (ADO) Not hierarchical like the DAO model Figure 5-7 ActiveX Data Objects Database Data Model (ADODB)

ActiveX Data Objects and Properties Figure 5-8 ActiveX Data Objects Extensions for DDL and Security Data Model (ADOX)

ActiveX Data Objects and Properties Figure 5-9 ActiveX Data Objects Jet Replication Objects Data Model (JRO)

Libraries The libraries needed to support ADOX and JRO are not automatically loaded by Access If using both DAO and ADO objects in an Access project: Specify which library to use when declaring objects DAO and ADO include several objects with the same names

Connection Object Connection object Establishes a connection to the database and defines a session in which a user interacts with the data Table 5-7 Commonly used ADODB Connection object properties

Connection Object Table 5-7 Commonly used ADODB Connection object properties (continued)

Catalog and Table Objects Catalog object Represents a database Table object Contains the definitions that define the table structures in the database Used to access properties of the table’s design

Catalog and Table Objects Table 5-8 Commonly used Table object properties

Catalog and Table Objects Some properties are optional Managed by the database engine only when they are created in VBA code or set by the system developer through Design or Datasheet view of an object Description property Created by Microsoft Access (not the database engine) through the Table property sheet

Field Objects and Properties Every Table object owns a Columns collection As you append columns to the Columns collection Specify the information needed for the Data Type

Index Objects and Properties Indexes are fields used to find and sort records in a table Keys are either primary keys or foreign keys Table 5-9 Commonly used ADOX Index properties

Table 5-10 Commonly used ADODB Command properties Command Object Command Object Can contain information needed to define a query Table 5-10 Commonly used ADODB Command properties

Recordset Objects and Properties Provide access to the actual data stored in and retrieved from the database ADO recognizes four general types of recordsets, which are determined by the CursorType property setting Dynamic cursors Fully scrollable

Recordset Objects and Properties Four general types of recordsets (cont.): KeySet cursors Fully scrollable, but do not offer the capability of seeing changes made by other users Forward Only cursors Not scrollable Static cursors Fully scrollable, yet do not offer the option of seeing changes made by anyone in a Static cursor

Recordset Objects and Properties Table 5-11 Allowed CursorType/LockType combinations in ADO

Recordset Objects and Properties Figure 5-10 Prospect processing module section

Recordset Objects and Properties Procedure-level (or local variable) A variable used only in the current procedure Table 5-12 Commonly used Recordset properties

Recordset Objects and Properties Bookmark property of a recordset Points to the current record EOF property Equals True when a previously executed Find method does not find a record that matches a specified criterion Equals True when the bookmark advances past the last record in the recordset

Objects Defined by Other Applications An Access application can use objects managed by other applications To write code that uses objects from another application: Microsoft Access References collection must contain an object that identifies the other application

Chapter Summary Access is an object-based database environment Tables, queries, forms, reports, and even database are objects Other objects that support data access activities are recordsets and workspaces

Chapter Summary Access maintains hundreds of data items, called properties, that describe the objects in an Access database Objects are grouped into collections Collections are associated with the user interface or with the database engine

Chapter Summary Generally, properties can be examined and changed by opening the property sheet associated with the object Most properties can be manipulated through VBA Macros and VBA allow programmers to change object properties while the program is running